From 4014ab6d2715c3f5cc408ce489fdb5798c6e72b6 Mon Sep 17 00:00:00 2001 From: Kathleen Tuite Date: Tue, 5 Nov 2024 16:27:50 -0800 Subject: [PATCH] Warn about <2024.1 entities spec and update tests --- lib/data/dataset.js | 10 +- lib/model/query/forms.js | 13 ++- test/data/xml.js | 49 +++++++++- test/integration/api/datasets.js | 95 ++++++++++++++----- .../other/empty-entity-structure.js | 2 +- .../other/form-entities-version.js | 68 ++++++------- test/integration/other/migrations.js | 28 +++--- test/unit/data/dataset.js | 12 +-- test/unit/data/schema.js | 12 +-- 9 files changed, 201 insertions(+), 88 deletions(-) diff --git a/lib/data/dataset.js b/lib/data/dataset.js index 6296eb2bf..04b5fb050 100644 --- a/lib/data/dataset.js +++ b/lib/data/dataset.js @@ -82,6 +82,14 @@ const getDataset = (xml) => else if (!semverSatisfies(version.get(), '2022.1.0 - 2024.1.x')) throw Problem.user.invalidEntityForm({ reason: `Entities specification version [${version.get()}] is not supported.` }); + let warnings; + if (semverSatisfies(version.get(), '<2024.1.x')) + warnings = { + type: 'oldEntityVersion', + details: { version: version.get() }, + reason: `Entities specification version [${version.get()}] is not compatible with Offline Entities. Please use version 2024.1.0 or later.` + }; + const strippedAttrs = Object.create(null); for (const [name, value] of Object.entries(entityAttrs.get())) strippedAttrs[stripNamespacesFromPath(name)] = value; @@ -101,7 +109,7 @@ const getDataset = (xml) => if (actions.length === 0) throw Problem.user.invalidEntityForm({ reason: 'The form must specify at least one entity action, for example, create or update.' }); - return Option.of({ name: datasetName, actions }); + return Option.of({ name: datasetName, actions, warnings }); }); module.exports = { getDataset, validateDatasetName, validatePropertyName }; diff --git a/lib/model/query/forms.js b/lib/model/query/forms.js index be3edc1b3..20309f7d3 100644 --- a/lib/model/query/forms.js +++ b/lib/model/query/forms.js @@ -134,6 +134,7 @@ const createNew = (partial, project) => async ({ Actees, Datasets, FormAttachmen // Check for xmlFormId collisions with previously deleted forms await Forms.checkDeletedForms(partial.xmlFormId, project.id); + await Forms.checkDatasetWarnings(parsedDataset); await Forms.rejectIfWarnings(); // Provision Actee for form @@ -761,6 +762,16 @@ const checkDeletedForms = (xmlFormId, projectId) => ({ maybeOne, context }) => ( } })); +const checkDatasetWarnings = (dataset) => ({ context }) => { + if (context.query.ignoreWarnings) return resolve(); + + if (dataset.isDefined() && dataset.get().warnings != null) { + if (!context.transitoryData.has('workflowWarnings')) context.transitoryData.set('workflowWarnings', []); + context.transitoryData.get('workflowWarnings').push(dataset.get().warnings); + } + return resolve(); +}; + const checkStructuralChange = (existingFields, fields) => ({ context }) => { if (context.query.ignoreWarnings) return resolve(); @@ -829,7 +840,7 @@ module.exports = { getByProjectId, getByProjectAndXmlFormId, getByProjectAndNumericId, getAllByAuth, getFields, getBinaryFields, getStructuralFields, getMergedFields, - rejectIfWarnings, checkMeta, checkDeletedForms, checkStructuralChange, checkFieldDowncast, + rejectIfWarnings, checkMeta, checkDeletedForms, checkStructuralChange, checkFieldDowncast, checkDatasetWarnings, _newSchema, lockDefs, getAllSubmitters }; diff --git a/test/data/xml.js b/test/data/xml.js index b248f7671..ba2c2b082 100644 --- a/test/data/xml.js +++ b/test/data/xml.js @@ -346,6 +346,30 @@ module.exports = { `, simpleEntity: ` + + + + + + + + + + + + + + + + + + + +`, + + // Copy of the above form with the original entities-version + simpleEntity2022: ` @@ -371,7 +395,7 @@ module.exports = { multiPropertyEntity: ` - + @@ -394,6 +418,29 @@ module.exports = { `, updateEntity: ` + + + + + + + + + + + + + + + + + + +`, + + // Copy of the above form with the original entities-version spec + updateEntity2023: ` diff --git a/test/integration/api/datasets.js b/test/integration/api/datasets.js index 87b2ac28d..bb6ed0274 100644 --- a/test/integration/api/datasets.js +++ b/test/integration/api/datasets.js @@ -2259,7 +2259,7 @@ describe('datasets and entities', () => { const updateForm = ` - + @@ -2267,7 +2267,7 @@ describe('datasets and entities', () => { - + @@ -2347,7 +2347,7 @@ describe('datasets and entities', () => { const differentDataset = ` - + @@ -2355,7 +2355,7 @@ describe('datasets and entities', () => { - + @@ -2490,7 +2490,7 @@ describe('datasets and entities', () => { const noDataset = ` - + @@ -2533,7 +2533,7 @@ describe('datasets and entities', () => { const caseChange = ` - + @@ -2541,7 +2541,7 @@ describe('datasets and entities', () => { - + @@ -2583,7 +2583,7 @@ describe('datasets and entities', () => { const caseChange = ` - + @@ -3442,10 +3442,57 @@ describe('datasets and entities', () => { describe('parsing datasets on form upload', () => { describe('parsing datasets at /projects/:id/forms POST', () => { + + describe('warnings about entities-version from before 2024.1.0', () => { + it('should warn if the entities-version is 2022.1.0 (earlier than 2024.1.0)', testService(async (service) => { + const asAlice = await service.login('alice'); + + await asAlice.post('/v1/projects/1/forms') + .send(testData.forms.simpleEntity2022) + .set('Content-Type', 'application/xml') + .expect(400) + .then(({ body }) => { + body.code.should.be.eql(400.16); + body.details.warnings.workflowWarnings[0].should.be.eql({ + type: 'oldEntityVersion', + details: { version: '2022.1.0' }, + reason: 'Entities specification version [2022.1.0] is not compatible with Offline Entities. Please use version 2024.1.0 or later.' + }); + }); + + await asAlice.post('/v1/projects/1/forms?ignoreWarnings=true') + .send(testData.forms.simpleEntity2022) + .set('Content-Type', 'application/xml') + .expect(200); + })); + + it('should warn if the entities-version is 2023.1.0 (earlier than 2024.1.0)', testService(async (service) => { + const asAlice = await service.login('alice'); + + await asAlice.post('/v1/projects/1/forms') + .send(testData.forms.updateEntity2023) + .set('Content-Type', 'application/xml') + .expect(400) + .then(({ body }) => { + body.code.should.be.eql(400.16); + body.details.warnings.workflowWarnings[0].should.be.eql({ + type: 'oldEntityVersion', + details: { version: '2023.1.0' }, + reason: 'Entities specification version [2023.1.0] is not compatible with Offline Entities. Please use version 2024.1.0 or later.' + }); + }); + + await asAlice.post('/v1/projects/1/forms?ignoreWarnings=true') + .send(testData.forms.updateEntity) + .set('Content-Type', 'application/xml') + .expect(200); + })); + }); + it('should return a Problem if the entity xml has the wrong version', testService((service) => service.login('alice', (asAlice) => asAlice.post('/v1/projects/1/forms') - .send(testData.forms.simpleEntity.replace('2022.1.0', 'bad-version')) + .send(testData.forms.simpleEntity.replace('2024.1.0', 'bad-version')) .set('Content-Type', 'text/xml') .expect(400) .then(({ body }) => { @@ -3509,7 +3556,7 @@ describe('datasets and entities', () => { const xml = ` nobinds - + @@ -3551,7 +3598,7 @@ describe('datasets and entities', () => { const alice = await service.login('alice'); const xml = ` - + @@ -3603,7 +3650,7 @@ describe('datasets and entities', () => { Repeat Children Entities - + @@ -4534,12 +4581,12 @@ describe('datasets and entities', () => { const form = ` - + - + @@ -4599,12 +4646,12 @@ describe('datasets and entities', () => { const form = ` - + - + @@ -4616,12 +4663,12 @@ describe('datasets and entities', () => { const form2 = ` - + - + @@ -4651,12 +4698,12 @@ describe('datasets and entities', () => { const form = ` - + - + @@ -4674,12 +4721,12 @@ describe('datasets and entities', () => { const form2 = ` - + - + @@ -4720,12 +4767,12 @@ describe('datasets and entities', () => { const form = ` - + - + diff --git a/test/integration/other/empty-entity-structure.js b/test/integration/other/empty-entity-structure.js index 1aac7af3b..4eb6d313a 100644 --- a/test/integration/other/empty-entity-structure.js +++ b/test/integration/other/empty-entity-structure.js @@ -9,7 +9,7 @@ const { testService } = require('../setup'); const emptyEntityForm = ` - + diff --git a/test/integration/other/form-entities-version.js b/test/integration/other/form-entities-version.js index 9d7cf92ba..ceed6a3bd 100644 --- a/test/integration/other/form-entities-version.js +++ b/test/integration/other/form-entities-version.js @@ -59,8 +59,8 @@ describe('Update / migrate entities-version within form', () => { const asAlice = await service.login('alice'); // Publish a form - await asAlice.post('/v1/projects/1/forms?publish=true') - .send(testData.forms.updateEntity) + await asAlice.post('/v1/projects/1/forms?publish=true&ignoreWarnings=true') + .send(testData.forms.updateEntity2023) .set('Content-Type', 'application/xml') .expect(200); @@ -86,8 +86,8 @@ describe('Update / migrate entities-version within form', () => { const asAlice = await service.login('alice'); // Upload a form but dont publish, leaving it as a draft - await asAlice.post('/v1/projects/1/forms') - .send(testData.forms.updateEntity) + await asAlice.post('/v1/projects/1/forms?ignoreWarnings=true') + .send(testData.forms.updateEntity2023) .set('Content-Type', 'application/xml') .expect(200); @@ -119,8 +119,8 @@ describe('Update / migrate entities-version within form', () => { const asAlice = await service.login('alice'); // Upload a form and publish it - await asAlice.post('/v1/projects/1/forms?publish=true') - .send(testData.forms.updateEntity) + await asAlice.post('/v1/projects/1/forms?publish=true&ignoreWarnings=true') + .send(testData.forms.updateEntity2023) .set('Content-Type', 'application/xml') .expect(200); @@ -160,20 +160,20 @@ describe('Update / migrate entities-version within form', () => { const asAlice = await service.login('alice'); // Publish a form - await asAlice.post('/v1/projects/1/forms?publish=true') - .send(testData.forms.updateEntity) + await asAlice.post('/v1/projects/1/forms?publish=true&ignoreWarnings=true') + .send(testData.forms.updateEntity2023) .set('Content-Type', 'application/xml') .expect(200); await asAlice.post('/v1/projects/1/forms/updateEntity/draft') - .send(testData.forms.updateEntity.replace('orx:version="1.0"', ' orx:version="2.0"')) + .send(testData.forms.updateEntity2023.replace('orx:version="1.0"', ' orx:version="2.0"')) .set('Content-Type', 'text/xml') .expect(200); await asAlice.post('/v1/projects/1/forms/updateEntity/draft/publish'); await asAlice.post('/v1/projects/1/forms/updateEntity/draft') - .send(testData.forms.updateEntity.replace('orx:version="1.0"', ' orx:version="3.0"')) + .send(testData.forms.updateEntity2023.replace('orx:version="1.0"', ' orx:version="3.0"')) .set('Content-Type', 'text/xml') .expect(200); @@ -197,7 +197,7 @@ describe('Update / migrate entities-version within form', () => { // Upload updateEntities form with xlsx global.xlsformForm = 'updateEntity'; - await asAlice.post('/v1/projects/1/forms?publish=true') + await asAlice.post('/v1/projects/1/forms?publish=true&ignoreWarnings=true') .send(readFileSync(appRoot + '/test/data/simple.xlsx')) .set('Content-Type', 'application/vnd.ms-excel') .set('X-XlsForm-FormId-Fallback', 'testformid') @@ -228,7 +228,7 @@ describe('Update / migrate entities-version within form', () => { // Upload updateEntities form with xlsx global.xlsformForm = 'updateEntity'; - await asAlice.post('/v1/projects/1/forms') + await asAlice.post('/v1/projects/1/forms?ignoreWarnings=true') .send(readFileSync(appRoot + '/test/data/simple.xlsx')) .set('Content-Type', 'application/vnd.ms-excel') .set('X-XlsForm-FormId-Fallback', 'testformid') @@ -262,7 +262,7 @@ describe('Update / migrate entities-version within form', () => { .replace('', ''); // Upload a form and publish it - await asAlice.post('/v1/projects/1/forms') + await asAlice.post('/v1/projects/1/forms?ignoreWarnings=true') .send(withAttachmentsEntities) .set('Content-Type', 'application/xml') .expect(200); @@ -341,8 +341,8 @@ describe('Update / migrate entities-version within form', () => { const domain = config.get('default.env.domain'); // Publish a form - await asAlice.post('/v1/projects/1/forms?publish=true') - .send(testData.forms.updateEntity) + await asAlice.post('/v1/projects/1/forms?publish=true&ignoreWarnings=true') + .send(testData.forms.updateEntity2023) .set('Content-Type', 'application/xml') .expect(200); @@ -410,8 +410,8 @@ describe('Update / migrate entities-version within form', () => { const asAlice = await service.login('alice'); // Upload a form and publish it - await asAlice.post('/v1/projects/1/forms') - .send(testData.forms.updateEntity) + await asAlice.post('/v1/projects/1/forms?ignoreWarnings=true') + .send(testData.forms.updateEntity2023) .set('Content-Type', 'application/xml') .expect(200); @@ -440,8 +440,8 @@ describe('Update / migrate entities-version within form', () => { const asAlice = await service.login('alice'); // Upload a form and publish it - await asAlice.post('/v1/projects/1/forms?publish=true') - .send(testData.forms.updateEntity) + await asAlice.post('/v1/projects/1/forms?publish=true&ignoreWarnings=true') + .send(testData.forms.updateEntity2023) .set('Content-Type', 'application/xml') .expect(200); @@ -470,8 +470,8 @@ describe('Update / migrate entities-version within form', () => { const asAlice = await service.login('alice'); // Upload a form and publish it - await asAlice.post('/v1/projects/1/forms?publish=true') - .send(testData.forms.updateEntity) + await asAlice.post('/v1/projects/1/forms?publish=true&ignoreWarnings=true') + .send(testData.forms.updateEntity2023) .set('Content-Type', 'application/xml') .expect(200); @@ -498,8 +498,8 @@ describe('Update / migrate entities-version within form', () => { const asAlice = await service.login('alice'); // Upload a form and publish it - await asAlice.post('/v1/projects/1/forms?publish=true') - .send(testData.forms.simpleEntity) + await asAlice.post('/v1/projects/1/forms?publish=true&ignoreWarnings=true') + .send(testData.forms.simpleEntity2022) .set('Content-Type', 'application/xml') .expect(200); @@ -541,8 +541,8 @@ describe('Update / migrate entities-version within form', () => { const asAlice = await service.login('alice'); // Upload a form and publish it - await asAlice.post('/v1/projects/1/forms?publish=true') - .send(testData.forms.updateEntity) + await asAlice.post('/v1/projects/1/forms?publish=true&ignoreWarnings=true') + .send(testData.forms.updateEntity2023) .set('Content-Type', 'application/xml') .expect(200); @@ -572,8 +572,8 @@ describe('Update / migrate entities-version within form', () => { const asAlice = await service.login('alice'); // Upload a form and publish it - await asAlice.post('/v1/projects/1/forms') - .send(testData.forms.updateEntity) + await asAlice.post('/v1/projects/1/forms?ignoreWarnings=true') + .send(testData.forms.updateEntity2023) .set('Content-Type', 'application/xml') .expect(200); @@ -603,8 +603,8 @@ describe('Update / migrate entities-version within form', () => { const asAlice = await service.login('alice'); // Upload a form and publish it - await asAlice.post('/v1/projects/1/forms?publish=true') - .send(testData.forms.updateEntity) + await asAlice.post('/v1/projects/1/forms?publish=true&ignoreWarnings=true') + .send(testData.forms.updateEntity2023) .set('Content-Type', 'application/xml') .expect(200); @@ -640,8 +640,8 @@ describe('Update / migrate entities-version within form', () => { const asAlice = await service.login('alice'); // Publish a form - await asAlice.post('/v1/projects/1/forms?publish=true') - .send(testData.forms.updateEntity) + await asAlice.post('/v1/projects/1/forms?publish=true&ignoreWarnings=true') + .send(testData.forms.updateEntity2023) .set('Content-Type', 'application/xml') .expect(200); @@ -661,8 +661,8 @@ describe('Update / migrate entities-version within form', () => { const asAlice = await service.login('alice'); // Publish an invalid XML form - const invalidForm = testData.forms.updateEntity.replace(' { const asAlice = await service.login('alice'); // Publish an XML form of the right version - await asAlice.post('/v1/projects/1/forms?publish=true') + await asAlice.post('/v1/projects/1/forms?publish=true&ignoreWarnings=true') .send(testData.forms.offlineEntity) .set('Content-Type', 'application/xml') .expect(200); diff --git a/test/integration/other/migrations.js b/test/integration/other/migrations.js index f7aacb384..b582c83da 100644 --- a/test/integration/other/migrations.js +++ b/test/integration/other/migrations.js @@ -1063,25 +1063,25 @@ testMigration('20240914-02-remove-orphaned-client-audits.js', () => { const asAlice = await service.login('alice'); // Upload one form with multiple versions - await asAlice.post('/v1/projects/1/forms?publish=true') - .send(testData.forms.updateEntity) + await asAlice.post('/v1/projects/1/forms?publish=true&ignoreWarnings=true') + .send(testData.forms.updateEntity2023) .expect(200); - await asAlice.post('/v1/projects/1/forms/updateEntity/draft') - .send(testData.forms.updateEntity.replace('orx:version="1.0"', 'orx:version="2.0"')) + await asAlice.post('/v1/projects/1/forms/updateEntity/draft?ignoreWarnings=true') + .send(testData.forms.updateEntity2023.replace('orx:version="1.0"', 'orx:version="2.0"')) .set('Content-Type', 'text/xml') .expect(200); await asAlice.post('/v1/projects/1/forms/updateEntity/draft/publish'); - await asAlice.post('/v1/projects/1/forms/updateEntity/draft') - .send(testData.forms.updateEntity.replace('orx:version="1.0"', 'orx:version="3.0"')) + await asAlice.post('/v1/projects/1/forms/updateEntity/draft?ignoreWarnings=true') + .send(testData.forms.updateEntity2023.replace('orx:version="1.0"', 'orx:version="3.0"')) .set('Content-Type', 'text/xml') .expect(200); // Upload another form that needs updating - await asAlice.post('/v1/projects/1/forms') - .send(testData.forms.updateEntity.replace('id="updateEntity"', 'id="updateEntity2"')) + await asAlice.post('/v1/projects/1/forms?ignoreWarnings=true') + .send(testData.forms.updateEntity2023.replace('id="updateEntity"', 'id="updateEntity2"')) .expect(200); // Upload an entity form that doesn't really need updating but does have 'update' in the actions column @@ -1090,14 +1090,14 @@ testMigration('20240914-02-remove-orphaned-client-audits.js', () => { .expect(200); // Upload an entity form that does not need updating - await asAlice.post('/v1/projects/1/forms') - .send(testData.forms.simpleEntity) + await asAlice.post('/v1/projects/1/forms?ignoreWarnings=true') + .send(testData.forms.simpleEntity2022) .expect(200); // Deleted forms and projects // Upload another form that needs updating but will be deleted - await asAlice.post('/v1/projects/1/forms') - .send(testData.forms.updateEntity.replace('id="updateEntity"', 'id="updateEntityDeleted"')) + await asAlice.post('/v1/projects/1/forms?ignoreWarnings=true') + .send(testData.forms.updateEntity2023.replace('id="updateEntity"', 'id="updateEntityDeleted"')) .expect(200); await asAlice.delete('/v1/projects/1/forms/updateEntityDeleted') @@ -1110,8 +1110,8 @@ testMigration('20240914-02-remove-orphaned-client-audits.js', () => { .then(({ body }) => body.id); // Upload a form that needs updating to the new project - await asAlice.post(`/v1/projects/${newProjectId}/forms?publish=true`) - .send(testData.forms.updateEntity) + await asAlice.post(`/v1/projects/${newProjectId}/forms?publish=true&ignoreWarnings=true`) + .send(testData.forms.updateEntity2023) .expect(200); // Delete the new project diff --git a/test/unit/data/dataset.js b/test/unit/data/dataset.js index 1e6dafb72..e609454c7 100644 --- a/test/unit/data/dataset.js +++ b/test/unit/data/dataset.js @@ -13,17 +13,17 @@ describe('parsing dataset from entity block', () => { describe('versioning', () => { it('should validate any version that starts with 2022.1.', () => - getDataset(testData.forms.simpleEntity + getDataset(testData.forms.simpleEntity2022 .replace('2022.1.0', '2022.1.123')) .should.be.fulfilled()); it('should validate a version between major releases, e.g. 2023.2.0', () => - getDataset(testData.forms.updateEntity + getDataset(testData.forms.updateEntity2023 .replace('2023.1.0', '2023.2.0')) .should.be.fulfilled()); it('should validate any version that starts with 2023.1.', () => - getDataset(testData.forms.updateEntity + getDataset(testData.forms.updateEntity2023 .replace('2023.1.0', '2023.1.123')) .should.be.fulfilled()); @@ -33,19 +33,19 @@ describe('parsing dataset from entity block', () => { .should.be.fulfilled()); it('should reject probable future version', () => - getDataset(testData.forms.simpleEntity + getDataset(testData.forms.simpleEntity2022 .replace('2022.1.0', '2025.1.0')) .should.be.rejectedWith(Problem, { problemCode: 400.25, message: 'The entity definition within the form is invalid. Entities specification version [2025.1.0] is not supported.' })); it('should complain if version is wrong', () => - getDataset(testData.forms.simpleEntity + getDataset(testData.forms.simpleEntity2022 .replace('entities-version="2022.1.0"', 'entities-version="bad-version"')) .should.be.rejectedWith(Problem, { problemCode: 400.25, message: 'The entity definition within the form is invalid. Entities specification version [bad-version] is not supported.' })); it('should complain if version is missing', () => - getDataset(testData.forms.simpleEntity + getDataset(testData.forms.simpleEntity2022 .replace('entities-version="2022.1.0"', '')) .should.be.rejectedWith(Problem, { problemCode: 400.25, message: 'The entity definition within the form is invalid. Entities specification version is missing.' })); diff --git a/test/unit/data/schema.js b/test/unit/data/schema.js index 7d6b3afd5..1052d6f04 100644 --- a/test/unit/data/schema.js +++ b/test/unit/data/schema.js @@ -2089,7 +2089,7 @@ describe('form schema', () => { describe('updateEntityForm', () => { it('should change version 2023->2024, add trunkVersion, and add branchId', (async () => { - const result = await updateEntityForm(testData.forms.updateEntity, '2023.1.0', '2024.1.0', '[upgrade]', true); + const result = await updateEntityForm(testData.forms.updateEntity2023, '2023.1.0', '2024.1.0', '[upgrade]', true); // entities-version has been updated // version has suffix // trunkVersion and branchId are present @@ -2117,7 +2117,7 @@ describe('form schema', () => { })); it('should change version 2022->2024', (async () => { - const result = await updateEntityForm(testData.forms.simpleEntity, '2022.1.0', '2024.1.0', '[upgrade]', false); + const result = await updateEntityForm(testData.forms.simpleEntity2022, '2022.1.0', '2024.1.0', '[upgrade]', false); // entities-version has been updated // version has suffix // trunkVersion and branchId are NOT added @@ -2148,8 +2148,8 @@ describe('form schema', () => { // updateEntityForm takes the old version to replace as an argument // these tests show it will not change a 2022.1 (create-only) form when 2023.1 is provided it('should not alter a version 2022.1.0 form when the old version to replace is 2023.1.0', (async () => { - const result = await updateEntityForm(testData.forms.simpleEntity, '2023.1.0', '2024.1.0', '[upgrade]', true); - result.should.equal(testData.forms.simpleEntity); + const result = await updateEntityForm(testData.forms.simpleEntity2022, '2023.1.0', '2024.1.0', '[upgrade]', true); + result.should.equal(testData.forms.simpleEntity2022); })); it('should not alter a version 2024.1.0 form when the old version to replace is 2023.1.0', (async () => { @@ -2159,8 +2159,8 @@ describe('form schema', () => { // these tests show it will not change a 2023.1 (update) form when 2022.1 is provided it('should not alter a version 2023.1.0 form when the old version to replace is 2022.1.0', (async () => { - const result = await updateEntityForm(testData.forms.updateEntity, '2022.1.0', '2024.1.0', '[upgrade]', true); - result.should.equal(testData.forms.updateEntity); + const result = await updateEntityForm(testData.forms.updateEntity2023, '2022.1.0', '2024.1.0', '[upgrade]', true); + result.should.equal(testData.forms.updateEntity2023); })); });