diff --git a/backend/server/models/BulkImport/csv/crossValidate.js b/backend/server/models/BulkImport/csv/crossValidate.js index a5e5c26c89..274a2b2dfb 100644 --- a/backend/server/models/BulkImport/csv/crossValidate.js +++ b/backend/server/models/BulkImport/csv/crossValidate.js @@ -62,9 +62,26 @@ const crossValidateTransferStaffRecord = async ( const relatedEstablishmentIds = myEstablishments.map((establishment) => establishment.id); const allMovingWorkers = myJSONWorkers.filter(isMovingToNewWorkplace); - const allNewWorkers = myJSONWorkers.filter((JSONWorker) => JSONWorker.status === 'NEW'); + const allNewWorkers = myJSONWorkers.filter((worker) => worker.status === 'NEW'); + const allOtherWorkers = myJSONWorkers.filter((worker) => !isMovingToNewWorkplace(worker) && worker.status !== 'NEW'); + + const newWorkerWithDuplicateIdErrorAdded = _crossValidateWorkersWithDuplicateRefsMovingToWorkplace( + csvWorkerSchemaErrors, + allMovingWorkers, + allNewWorkers, + TRANSFER_STAFF_RECORD_ERRORS.SameRefsMovingToWorkplace, + ); + + if (newWorkerWithDuplicateIdErrorAdded) return; - _crossValidateWorkersWithSameRefMovingToSameWorkplace(csvWorkerSchemaErrors, allMovingWorkers, allNewWorkers); + const existingWorkerWithDuplicateIdErrorAdded = _crossValidateWorkersWithDuplicateRefsMovingToWorkplace( + csvWorkerSchemaErrors, + allMovingWorkers, + allOtherWorkers, + TRANSFER_STAFF_RECORD_ERRORS.SameLocalIdExistInNewWorkplace, + ); + + if (existingWorkerWithDuplicateIdErrorAdded) return; for (const JSONWorker of allMovingWorkers) { const newWorkplaceId = await _validateTransferIsPossible( @@ -92,12 +109,21 @@ const _validateTransferIsPossible = async (csvWorkerSchemaErrors, relatedEstabli return; } - const sameLocalIdExistInNewWorkplace = await models.worker.findOneWithConflictingLocalRef( + const workerReferenceToLookup = JSONWorker.changeUniqueWorker + ? JSONWorker.changeUniqueWorker + : JSONWorker.uniqueWorkerId; + + // if worker with duplicated reference found in database but not in csv file, + // changes to unique worker ID are applied before deleting workers not in file, + // which would cause bulk upload to break + // the code below prevents this issue + + const uniqueWorkerIdFoundInWorkplaceInDatabase = await models.worker.findOneWithConflictingLocalRef( newWorkplaceId, - JSONWorker.uniqueWorkerId, + workerReferenceToLookup, ); - if (sameLocalIdExistInNewWorkplace) { + if (uniqueWorkerIdFoundInWorkplaceInDatabase) { addCrossValidateError( csvWorkerSchemaErrors, TRANSFER_STAFF_RECORD_ERRORS.SameLocalIdExistInNewWorkplace, @@ -139,19 +165,27 @@ const _addNewWorkplaceIdToWorkerEntity = (myAPIEstablishments, JSONWorker, newWo const workerEntity = myAPIEstablishments[oldWorkplaceKey].theWorker(workerEntityKey); - workerEntity._newWorkplaceId = newWorkplaceId; + if (workerEntity) { + workerEntity._newWorkplaceId = newWorkplaceId; + } }; -const _crossValidateWorkersWithSameRefMovingToSameWorkplace = ( +const _crossValidateWorkersWithDuplicateRefsMovingToWorkplace = ( csvWorkerSchemaErrors, allMovingWorkers, - allNewWorkers, + otherWorkers, + errorType, ) => { - const workplacesDict = _buildWorkplaceDictWithNewWorkers(allNewWorkers); + const workplacesDict = _buildWorkplaceDictWithOtherWorkers(otherWorkers); + + let errorAdded = false; for (const JSONWorker of allMovingWorkers) { const newWorkplaceRef = JSONWorker.transferStaffRecord; - const workerRef = JSONWorker.uniqueWorkerId.replace(/\s/g, ''); + + const workerRef = JSONWorker.changeUniqueWorker + ? JSONWorker.changeUniqueWorker.replace(/\s/g, '') + : JSONWorker.uniqueWorkerId.replace(/\s/g, ''); if (!workplacesDict[newWorkplaceRef]) { workplacesDict[newWorkplaceRef] = new Set([workerRef]); @@ -162,17 +196,27 @@ const _crossValidateWorkersWithSameRefMovingToSameWorkplace = ( workplacesDict[newWorkplaceRef].add(workerRef); continue; } + // worker's ID exists in workplace in file + addCrossValidateError(csvWorkerSchemaErrors, errorType, JSONWorker); - // if arrive at here, there is already another new or moving worker with that workerRef coming to the same new workplace - addCrossValidateError(csvWorkerSchemaErrors, TRANSFER_STAFF_RECORD_ERRORS.SameRefsMovingToWorkplace, JSONWorker); + errorAdded = true; } + + return errorAdded; }; -const _buildWorkplaceDictWithNewWorkers = (allNewWorkers) => { - return chain(allNewWorkers) +const _buildWorkplaceDictWithOtherWorkers = (otherWorkers) => { + return chain(otherWorkers) .groupBy('localId') // workplace ref - .mapValues((JSONWorkers) => JSONWorkers.map((JSONWorker) => JSONWorker.uniqueWorkerId.replace(/\s/g, ''))) - .mapValues((workerRefs) => new Set(workerRefs)) + .mapValues((JSONWorkers) => + JSONWorkers.map((JSONWorker) => { + if (JSONWorker.changeUniqueWorker) { + return [JSONWorker.changeUniqueWorker.replace(/\s/g, ''), JSONWorker.uniqueWorkerId.replace(/\s/g, '')]; + } + return [JSONWorker.uniqueWorkerId.replace(/\s/g, '')]; + }), + ) + .mapValues((workerRefs) => new Set(workerRefs.flat())) .value(); }; diff --git a/backend/server/models/BulkImport/csv/crossValidateErrors.js b/backend/server/models/BulkImport/csv/crossValidateErrors.js index c5a8ae864b..e17163368c 100644 --- a/backend/server/models/BulkImport/csv/crossValidateErrors.js +++ b/backend/server/models/BulkImport/csv/crossValidateErrors.js @@ -25,7 +25,8 @@ const TRANSFER_STAFF_RECORD_ERRORS = { errType: 'TRANSFERSTAFFRECORD_ERROR', column: 'UNIQUEWORKERID', _sourceFieldName: 'uniqueWorkerId', - error: 'The UNIQUEWORKERID already exists in the LOCALESTID given in TRANSFERSTAFFRECORD', + error: + "The UNIQUEWORKERID already exists in the LOCALESTID given in TRANSFERSTAFFRECORD. Use CHGUNIQUEWRKID to change this worker's UNIQUEWORKERID.", }), SameRefsMovingToWorkplace: Object.freeze({ errCode: TRANSFER_STAFF_RECORD_BASE_ERROR_CODE + 3, diff --git a/backend/server/routes/establishments/bulkUpload/data/workerHeaders.js b/backend/server/routes/establishments/bulkUpload/data/workerHeaders.js index 4971d87f34..4f4c601bb3 100644 --- a/backend/server/routes/establishments/bulkUpload/data/workerHeaders.js +++ b/backend/server/routes/establishments/bulkUpload/data/workerHeaders.js @@ -56,7 +56,16 @@ const workerHeadersWithTransferStaffRecordAsArray = [ ...workerHeaders.slice(2), ]; +const workerHeadersWithChangeUniqueWorkerIdAndTransferStaffRecordAsArray = [ + ...workerHeaders.slice(0, 2), + 'CHGUNIQUEWRKID', + 'TRANSFERSTAFFRECORD', + ...workerHeaders.slice(2), +]; + exports.workerHeadersWithCHGUNIQUEWRKID = workerHeadersWithChangeUniqueWorkerIdAsArray.join(','); exports.workerHeadersWithTRANSFERSTAFFRECORD = workerHeadersWithTransferStaffRecordAsArray.join(','); exports.workerHeadersWithoutCHGUNIQUEWRKID = workerHeaders.join(','); +exports.workerHeadersWithCHGUNIQUEWRKIDAndTRANSFERSTAFFRECORD = + workerHeadersWithChangeUniqueWorkerIdAndTransferStaffRecordAsArray.join(','); exports.getWorkerColumnIndex = (columnName) => workerHeaders.findIndex((header) => header === columnName); diff --git a/backend/server/routes/establishments/bulkUpload/validate/headers/worker.js b/backend/server/routes/establishments/bulkUpload/validate/headers/worker.js index f4717ff54b..9eb6545404 100644 --- a/backend/server/routes/establishments/bulkUpload/validate/headers/worker.js +++ b/backend/server/routes/establishments/bulkUpload/validate/headers/worker.js @@ -2,6 +2,7 @@ const { workerHeadersWithCHGUNIQUEWRKID, workerHeadersWithoutCHGUNIQUEWRKID, workerHeadersWithTRANSFERSTAFFRECORD, + workerHeadersWithCHGUNIQUEWRKIDAndTRANSFERSTAFFRECORD, } = require('../../data/workerHeaders'); const validateWorkerHeaders = (headers) => { @@ -9,6 +10,7 @@ const validateWorkerHeaders = (headers) => { workerHeadersWithoutCHGUNIQUEWRKID, workerHeadersWithCHGUNIQUEWRKID, workerHeadersWithTRANSFERSTAFFRECORD, + workerHeadersWithCHGUNIQUEWRKIDAndTRANSFERSTAFFRECORD, ]; for (const workerHeadersBeforeExtraQuals of allowedWorkerHeaders) { diff --git a/backend/server/routes/establishments/bulkUpload/whichFile.js b/backend/server/routes/establishments/bulkUpload/whichFile.js index aac8f697a2..03b796a8ef 100644 --- a/backend/server/routes/establishments/bulkUpload/whichFile.js +++ b/backend/server/routes/establishments/bulkUpload/whichFile.js @@ -4,7 +4,15 @@ const isWorkerFile = (fileAsString) => { const headersRegexBaseCase = /LOCALESTID,UNIQUEWORKERID,STATUS,DISPLAYID,/; const headersRegexChangeUniqueWorkerId = /LOCALESTID,UNIQUEWORKERID,CHGUNIQUEWRKID,STATUS,DISPLAYID,/; const headersRegexTransferStaffRecord = /LOCALESTID,UNIQUEWORKERID,TRANSFERSTAFFRECORD,STATUS,DISPLAYID,/; - const regexToCheckHeaders = [headersRegexBaseCase, headersRegexChangeUniqueWorkerId, headersRegexTransferStaffRecord]; + const headersRegexChangeUniqueWorkerIdTransferStaffRecord = + /LOCALESTID,UNIQUEWORKERID,CHGUNIQUEWRKID,TRANSFERSTAFFRECORD,STATUS,DISPLAYID,/; + + const regexToCheckHeaders = [ + headersRegexBaseCase, + headersRegexChangeUniqueWorkerId, + headersRegexTransferStaffRecord, + headersRegexChangeUniqueWorkerIdTransferStaffRecord, + ]; const headerRow = fileAsString.split('\n')[0]; diff --git a/backend/server/test/unit/models/Bulkimport/csv/crossValidate.spec.js b/backend/server/test/unit/models/Bulkimport/csv/crossValidate.spec.js index 1b43ef1ae7..17ed75223c 100644 --- a/backend/server/test/unit/models/Bulkimport/csv/crossValidate.spec.js +++ b/backend/server/test/unit/models/Bulkimport/csv/crossValidate.spec.js @@ -211,8 +211,8 @@ describe('crossValidate', () => { }); describe('crossValidateTransferStaffRecord', () => { - const worker = new WorkerCsvValidator(null, null, null, mappings); const buildMockJSONWorker = (override) => { + const worker = new WorkerCsvValidator(null, null, null, mappings); return { ...worker.toJSON(), status: 'UPDATE', @@ -279,33 +279,73 @@ describe('crossValidate', () => { }); }); - it("should add an error to csvWorkerSchemaErrors if the worker's unique worker id is already used in the new workplace", async () => { + it("should add an error to csvWorkerSchemaErrors if the worker's unique worker id is already in the new workplace in file", async () => { + const movingWorker = buildMockJSONWorker({ + uniqueWorkerId: 'mock_worker_ref', + localId: 'workplace A', + }); + + const existingWorkerInWorkplace = buildMockJSONWorker({ + uniqueWorkerId: 'mock_worker_ref', + status: 'UPDATE', + transferStaffRecord: null, + localId: 'target workplace', + }); + + const csvWorkerSchemaErrors = []; + + await crossValidateTransferStaffRecord(csvWorkerSchemaErrors, myAPIEstablishments, myEstablishments, [ + movingWorker, + existingWorkerInWorkplace, + ]); + + const expectedError = { + column: 'UNIQUEWORKERID', + errCode: 1402, + errType: 'TRANSFERSTAFFRECORD_ERROR', + error: + "The UNIQUEWORKERID already exists in the LOCALESTID given in TRANSFERSTAFFRECORD. Use CHGUNIQUEWRKID to change this worker's UNIQUEWORKERID.", + worker: movingWorker.uniqueWorkerId, + name: movingWorker.localId, + lineNumber: movingWorker.lineNumber, + source: movingWorker.uniqueWorkerId, + }; + + expect(csvWorkerSchemaErrors).to.deep.equal([expectedError]); + }); + + it("should add an error to csvWorkerSchemaErrors if the worker's unique worker id is not in file but is found in database", async () => { stubWorkerFindOneWithLocalRef.returns({ - NameOrIdValue: 'another worker', + id: 123, + NameOrIdValue: 'Mock Worker', LocalIdentifierValue: 'mock_worker_ref', }); - const JSONWorker = buildMockJSONWorker({ uniqueWorkerId: 'mock_worker_ref' }); + const movingWorker = buildMockJSONWorker({ + uniqueWorkerId: 'mock_worker_ref', + localId: 'workplace A', + }); const csvWorkerSchemaErrors = []; await crossValidateTransferStaffRecord(csvWorkerSchemaErrors, myAPIEstablishments, myEstablishments, [ - JSONWorker, + movingWorker, ]); const expectedError = { column: 'UNIQUEWORKERID', errCode: 1402, errType: 'TRANSFERSTAFFRECORD_ERROR', - error: 'The UNIQUEWORKERID already exists in the LOCALESTID given in TRANSFERSTAFFRECORD', - worker: JSONWorker.uniqueWorkerId, - name: JSONWorker.localId, - lineNumber: JSONWorker.lineNumber, - source: JSONWorker.uniqueWorkerId, + error: + "The UNIQUEWORKERID already exists in the LOCALESTID given in TRANSFERSTAFFRECORD. Use CHGUNIQUEWRKID to change this worker's UNIQUEWORKERID.", + worker: movingWorker.uniqueWorkerId, + name: movingWorker.localId, + lineNumber: movingWorker.lineNumber, + source: movingWorker.uniqueWorkerId, }; - expect(csvWorkerSchemaErrors).to.deep.equal([expectedError]); expect(stubWorkerFindOneWithLocalRef).to.have.been.calledWith(789, 'mock_worker_ref'); + expect(csvWorkerSchemaErrors).to.deep.equal([expectedError]); }); it('should add an error to csvWorkerSchemaErrors if two workers with the same unique worker id are transferring into the same new workplace', async () => { @@ -362,7 +402,111 @@ describe('crossValidate', () => { expect(csvWorkerSchemaErrors).to.deep.equal([expectedError]); }); - it('should add newWorkplaceId to the worker entity if all validations passed', async () => { + it("should add an error to csvWorkerSchemaErrors if transferring worker to workplace with worker with same ref, even if the worker's ID is being changed", async () => { + const movingWorker = buildMockJSONWorker({ uniqueWorkerId: 'mock_worker_ref', localId: 'workplace A' }); + const existingWorkerInWorkplace = buildMockJSONWorker({ + uniqueWorkerId: 'mock_worker_ref', + status: 'UPDATE', + changeUniqueWorker: 'new_unique_worker_ref', + transferStaffRecord: null, + localId: 'target workplace', + }); + + const csvWorkerSchemaErrors = []; + + await crossValidateTransferStaffRecord(csvWorkerSchemaErrors, myAPIEstablishments, myEstablishments, [ + movingWorker, + existingWorkerInWorkplace, + ]); + + const expectedError = { + column: 'UNIQUEWORKERID', + errCode: 1402, + errType: 'TRANSFERSTAFFRECORD_ERROR', + error: + "The UNIQUEWORKERID already exists in the LOCALESTID given in TRANSFERSTAFFRECORD. Use CHGUNIQUEWRKID to change this worker's UNIQUEWORKERID.", + worker: movingWorker.uniqueWorkerId, + name: movingWorker.localId, + lineNumber: movingWorker.lineNumber, + source: movingWorker.uniqueWorkerId, + }; + + expect(csvWorkerSchemaErrors).to.deep.equal([expectedError]); + }); + + it("should not add an error to csvWorkerSchemaErrors and add newWorkplaceId to worker entity if transferring worker to workplace with worker with same ref but moving worker's ID is being changed", async () => { + const movingWorker = buildMockJSONWorker({ + uniqueWorkerId: 'mock_worker_ref', + localId: 'workplace A', + changeUniqueWorker: 'new_unique_worker_ref', + }); + + const existingWorkerInWorkplace = buildMockJSONWorker({ + uniqueWorkerId: 'mock_worker_ref', + status: 'UPDATE', + transferStaffRecord: null, + localId: 'target workplace', + }); + + const csvWorkerSchemaErrors = []; + + await crossValidateTransferStaffRecord(csvWorkerSchemaErrors, myAPIEstablishments, myEstablishments, [ + movingWorker, + existingWorkerInWorkplace, + ]); + + expect(csvWorkerSchemaErrors).to.be.empty; + + const workerEntity = myAPIEstablishments['workplaceA']._workerEntities['mock_worker_ref']; + expect(workerEntity._newWorkplaceId).to.equal(789); + expect(stubWorkerFindOneWithLocalRef).to.have.been.calledWith(789, 'new_unique_worker_ref'); + }); + + it("should add an error to csvWorkerSchemaErrors if transferring worker to workplace with worker with same ref and moving worker's ID is being changed to existing ref", async () => { + const movingWorker = buildMockJSONWorker({ + uniqueWorkerId: 'mock_worker_ref', + localId: 'workplace A', + changeUniqueWorker: 'changed_but_still_duplicate_worker_ref', + }); + + const existingWorkerInWorkplace = buildMockJSONWorker({ + uniqueWorkerId: 'mock_worker_ref', + status: 'UPDATE', + transferStaffRecord: null, + localId: 'target workplace', + }); + + const existingWorker2InWorkplace = buildMockJSONWorker({ + uniqueWorkerId: 'changed_but_still_duplicate_worker_ref', + status: 'UPDATE', + transferStaffRecord: null, + localId: 'target workplace', + }); + + const csvWorkerSchemaErrors = []; + + await crossValidateTransferStaffRecord(csvWorkerSchemaErrors, myAPIEstablishments, myEstablishments, [ + movingWorker, + existingWorkerInWorkplace, + existingWorker2InWorkplace, + ]); + + const expectedError = { + column: 'UNIQUEWORKERID', + errCode: 1402, + errType: 'TRANSFERSTAFFRECORD_ERROR', + error: + "The UNIQUEWORKERID already exists in the LOCALESTID given in TRANSFERSTAFFRECORD. Use CHGUNIQUEWRKID to change this worker's UNIQUEWORKERID.", + worker: movingWorker.uniqueWorkerId, + name: movingWorker.localId, + lineNumber: movingWorker.lineNumber, + source: movingWorker.uniqueWorkerId, + }; + + expect(csvWorkerSchemaErrors).to.deep.equal([expectedError]); + }); + + it('should add newWorkplaceId to the worker entity if all validations pass for worker with transferStaffRecord', async () => { const JSONWorker = buildMockJSONWorker({ localId: 'workplace A', uniqueWorkerId: 'mock_worker_ref' }); const csvWorkerSchemaErrors = []; @@ -376,5 +520,42 @@ describe('crossValidate', () => { const workerEntity = myAPIEstablishments['workplaceA']._workerEntities['mock_worker_ref']; expect(workerEntity._newWorkplaceId).to.equal(789); }); + + it('should not add errors if no workers with transferStaffRecord', async () => { + const buildMockJSONWorkerWithoutTransferStaffRecord = (override) => { + const worker = new WorkerCsvValidator(null, null, null, mappings); + return { + ...worker.toJSON(), + status: 'UPDATE', + transferStaffRecord: null, + uniqueWorkerId: 'mock_worker_ref', + lineNumber: 3, + ...override, + }; + }; + + const worker1 = buildMockJSONWorkerWithoutTransferStaffRecord({ + localId: 'workplace A', + uniqueWorkerId: 'mock_worker_ref', + }); + const worker2 = buildMockJSONWorkerWithoutTransferStaffRecord({ + localId: 'workplace B', + uniqueWorkerId: 'mock_worker_ref', + }); + const worker3 = buildMockJSONWorkerWithoutTransferStaffRecord({ + localId: 'workplace A', + uniqueWorkerId: 'mock_worker_ref2', + }); + + const csvWorkerSchemaErrors = []; + + await crossValidateTransferStaffRecord(csvWorkerSchemaErrors, myAPIEstablishments, myEstablishments, [ + worker1, + worker2, + worker3, + ]); + + expect(csvWorkerSchemaErrors).to.be.empty; + }); }); }); diff --git a/backend/server/test/unit/routes/establishments/bulkUpload/validate/headers/worker.spec.js b/backend/server/test/unit/routes/establishments/bulkUpload/validate/headers/worker.spec.js index 3a9c90af5f..cc1007af46 100644 --- a/backend/server/test/unit/routes/establishments/bulkUpload/validate/headers/worker.spec.js +++ b/backend/server/test/unit/routes/establishments/bulkUpload/validate/headers/worker.spec.js @@ -17,6 +17,11 @@ const workerHeadersWithTRANSFERSTAFFRECORD = workerHeadersWithCHGUNIQUEWRKID.rep 'TRANSFERSTAFFRECORD', ); +const workerHeadersWithCHGUNIQUEWRKIDAndTRANSFERSTAFFRECORD = workerHeadersWithCHGUNIQUEWRKID.replace( + 'CHGUNIQUEWRKID', + 'CHGUNIQUEWRKID,TRANSFERSTAFFRECORD', +); + const workerHeadersWithoutCHGUNIQUEWRKID = 'LOCALESTID,UNIQUEWORKERID,STATUS,DISPLAYID,NINUMBER,' + 'POSTCODE,DOB,GENDER,ETHNICITY,NATIONALITY,BRITISHCITIZENSHIP,COUNTRYOFBIRTH,YEAROFENTRY,' + @@ -39,6 +44,10 @@ describe('server/routes/establishments/bulkUpload/validate/headers/worker', () = expect(validateWorkerHeaders(workerHeadersWithoutCHGUNIQUEWRKID)).to.deep.equal(true); }); + it('should return true when headings match with CHGUNIQUEWRKID and TRANSFERSTAFFRECORD', async () => { + expect(validateWorkerHeaders(workerHeadersWithCHGUNIQUEWRKIDAndTRANSFERSTAFFRECORD)).to.equal(true); + }); + it('should return false when header (NATIONALITY) missing', async () => { const invalidHeaders = workerHeadersWithoutCHGUNIQUEWRKID.replace('NATIONALITY,', ''); @@ -50,6 +59,7 @@ describe('server/routes/establishments/bulkUpload/validate/headers/worker', () = workerHeadersWithCHGUNIQUEWRKID, workerHeadersWithoutCHGUNIQUEWRKID, workerHeadersWithTRANSFERSTAFFRECORD, + workerHeadersWithCHGUNIQUEWRKIDAndTRANSFERSTAFFRECORD, ]; testCases.forEach((workerHeaders) => { diff --git a/backend/server/test/unit/routes/establishments/bulkUpload/whichFile.spec.js b/backend/server/test/unit/routes/establishments/bulkUpload/whichFile.spec.js index 8e7d3e13d1..386e69430a 100644 --- a/backend/server/test/unit/routes/establishments/bulkUpload/whichFile.spec.js +++ b/backend/server/test/unit/routes/establishments/bulkUpload/whichFile.spec.js @@ -22,6 +22,11 @@ describe('whichFile', () => { expect(isWorkerFile(header)).to.deep.equal(true); }); + it('return true when headings match with CHGUNIQUEWRKID and TRANSFERSTAFFRECORD', async () => { + const header = 'LOCALESTID,UNIQUEWORKERID,CHGUNIQUEWRKID,TRANSFERSTAFFRECORD,STATUS,DISPLAYID,NINUMBER'; + expect(isWorkerFile(header)).to.deep.equal(true); + }); + it("return false when headings don't match", async () => { const header = 'NOTATALLWHATWEEXPECT,HOWCOULDYOUUPLOADTHISFILE,'; expect(isWorkerFile(header)).to.deep.equal(false);