Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ktuite committed Dec 3, 2024
1 parent 111b262 commit 6e5cea0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 7 additions & 5 deletions lib/model/query/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ const createVersion = (partial, form, publish, duplicating = false) => async ({
const [fields, parsedDataset] = await _parseFormXml(partial);

// Check entities spec version
await Forms.checkDatasetWarnings(parsedDataset);
await Forms.rejectIfWarnings();
if (!duplicating)
await Forms.checkDatasetWarnings(parsedDataset);

// Compute the intermediate schema ID
let schemaId;
Expand All @@ -245,15 +245,17 @@ const createVersion = (partial, form, publish, duplicating = false) => async ({

// skip checking for structural change if duplicating because user has already
// been warning at the time of form definition upload
if (!duplicating) {
if (!duplicating)
await Forms.checkStructuralChange(prevFields, fields);
await Forms.rejectIfWarnings();
}

// If we haven't been rejected or warned yet, make a new schema id
schemaId = await Forms._newSchema();
}
}

// Reject if there are dataset warnings or structural change warnings
await Forms.rejectIfWarnings();

// If not publishing, check whether there is an existing draft that we have access to.
// If not, generate a draft token and enketoId.
let { draftToken, enketoId } = form.def;
Expand Down
8 changes: 5 additions & 3 deletions test/integration/other/form-entities-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const upgradedSimpleEntity = `<?xml version="1.0"?>
</h:head>
</h:html>`;

describe('Update / migrate entities-version within form', () => {
describe.only('Update / migrate entities-version within form', () => {

Check failure on line 55 in test/integration/other/form-entities-version.js

View workflow job for this annotation

GitHub Actions / standard-tests

describe.only not permitted
describe('upgrading a 2023.1.0 update form', () => {
it('should upgrade a form with only a published version', testService(async (service, container) => {
const { Forms, Audits } = container;
Expand Down Expand Up @@ -114,7 +114,7 @@ describe('Update / migrate entities-version within form', () => {
.then(({ text }) => text.should.equal(upgradedUpdateEntity));
}));

it('should upgrade a form with a draft version and a published version', testService(async (service, container) => {
it.only('should upgrade a form with a draft version and a published version', testService(async (service, container) => {

Check failure on line 117 in test/integration/other/form-entities-version.js

View workflow job for this annotation

GitHub Actions / standard-tests

it.only not permitted
const { Forms, Audits } = container;
const asAlice = await service.login('alice');

Expand All @@ -125,7 +125,9 @@ describe('Update / migrate entities-version within form', () => {
.expect(200);

// Convert the published form to a draft
await asAlice.post('/v1/projects/1/forms/updateEntity/draft');
await asAlice.post('/v1/projects/1/forms/updateEntity/draft')
.then(({ body }) => { console.log(body); });

Check failure on line 129 in test/integration/other/form-entities-version.js

View workflow job for this annotation

GitHub Actions / standard-tests

Multiple spaces found before 'console'

Check warning on line 129 in test/integration/other/form-entities-version.js

View workflow job for this annotation

GitHub Actions / standard-tests

Unexpected console statement
// .expect(200);

const { acteeId } = await Forms.getByProjectAndXmlFormId(1, 'updateEntity').then(o => o.get());
await Audits.log(null, 'upgrade.process.form.entities_version', { acteeId });
Expand Down

0 comments on commit 6e5cea0

Please sign in to comment.