Skip to content

Commit

Permalink
Unskip tests by preventing additional entity.error
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-white committed Sep 23, 2024
1 parent af7b04a commit f545011
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
12 changes: 6 additions & 6 deletions test/integration/api/datasets.js
Original file line number Diff line number Diff line change
Expand Up @@ -5545,7 +5545,7 @@ describe('datasets and entities', () => {
}));

describe('central issue #547, reprocessing submissions that had previous entity errors', () => {
it.skip('should not reprocess submission that previously generated entity.error', testService(async (service, container) => {
it('should not reprocess submission that previously generated entity.error', testService(async (service, container) => {
const asAlice = await service.login('alice');

// Upload form that creates an entity list and publish it
Expand All @@ -5559,10 +5559,10 @@ describe('datasets and entities', () => {
.send({ approvalRequired: true })
.expect(200);

// Create a submission that fails to create an entity (bad UUID)
// Create a submission that fails to create an entity (empty label)
await asAlice.post('/v1/projects/1/forms/simpleEntity/submissions')
.send(testData.instances.simpleEntity.one
.replace('id="uuid:12345678-1234-4123-8234-123456789abc"', 'id="uuid:invalid_uuid"'))
.replace('<entities:label>Alice (88)</entities:label>', ''))
.set('Content-Type', 'application/xml')
.expect(200);

Expand Down Expand Up @@ -5608,7 +5608,7 @@ describe('datasets and entities', () => {
});
}));

it.skip('should reprocess submission that was edited after previously generating entity.error', testService(async (service, container) => {
it('should reprocess submission that was edited after previously generating entity.error', testService(async (service, container) => {
const asAlice = await service.login('alice');

// Upload form that creates an entity list and publish it
Expand All @@ -5622,10 +5622,10 @@ describe('datasets and entities', () => {
.send({ approvalRequired: true })
.expect(200);

// Create a submission that fails to create an entity (bad UUID)
// Create a submission that fails to create an entity (empty label)
await asAlice.post('/v1/projects/1/forms/simpleEntity/submissions')
.send(testData.instances.simpleEntity.one
.replace('id="uuid:12345678-1234-4123-8234-123456789abc"', 'id="uuid:invalid_uuid"'))
.replace('<entities:label>Alice (88)</entities:label>', ''))
.set('Content-Type', 'application/xml')
.expect(200);

Expand Down
16 changes: 2 additions & 14 deletions test/integration/other/analytics-queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -993,24 +993,20 @@ describe('analytics task queries', function () {
datasets[0].num_entities_recent.should.be.equal(1);
}));

it.skip('should calculate failed entities', testService(async (service, container) => {
it('should calculate failed entities', testService(async (service, container) => {
const asAlice = await service.login('alice');

Check failure on line 997 in test/integration/other/analytics-queries.js

View workflow job for this annotation

GitHub Actions / standard-tests

'asAlice' is assigned a value but never used

await createTestForm(service, container, testData.forms.simpleEntity, 1);
await approvalRequired(service, 1, 'people');
await submitToForm(service, 'alice', 1, 'simpleEntity', testData.instances.simpleEntity.one);
await asAlice.patch('/v1/projects/1/forms/simpleEntity/submissions/one').send({ reviewState: 'approved' });

// let's pass invalid UUID
await submitToForm(service, 'alice', 1, 'simpleEntity', testData.instances.simpleEntity.two.replace(/aaa/, 'xxx'));
await asAlice.patch('/v1/projects/1/forms/simpleEntity/submissions/two').send({ reviewState: 'approved' });
await exhaust(container);

// let's set date of entity errors to long time ago
await container.run(sql`UPDATE audits SET "loggedAt" = '1999-1-1' WHERE action = 'entity.error'`);

await submitToForm(service, 'alice', 1, 'simpleEntity', testData.instances.simpleEntity.three.replace(/bbb/, 'xxx'));
await asAlice.patch('/v1/projects/1/forms/simpleEntity/submissions/three').send({ reviewState: 'approved' });
await exhaust(container);

const datasets = await container.Analytics.getDatasets();
Expand Down Expand Up @@ -1589,36 +1585,31 @@ describe('analytics task queries', function () {
res.projects[1].submissions.num_submissions_approved.total.should.equal(0);
}));

it.skip('should fill in all project.datasets queries', testService(async (service, container) => {
it('should fill in all project.datasets queries', testService(async (service, container) => {
const { defaultMaxListeners } = require('events').EventEmitter;
require('events').EventEmitter.defaultMaxListeners = 30;

const asAlice = await service.login('alice');

// Create first Dataset
await createTestForm(service, container, testData.forms.simpleEntity, 1);
await approvalRequired(service, 1, 'people');

// Make submission for the first Dataset
await submitToForm(service, 'alice', 1, 'simpleEntity', testData.instances.simpleEntity.one);
await asAlice.patch('/v1/projects/1/forms/simpleEntity/submissions/one').send({ reviewState: 'approved' });

// Create second Dataset using two forms
await createTestForm(service, container, testData.forms.simpleEntity.replace(/simpleEntity|people/g, 'employees'), 1);
await approvalRequired(service, 1, 'employees');
await createTestForm(service, container, testData.forms.simpleEntity
.replace(/simpleEntity/, 'employees2')
.replace(/people/, 'employees')
.replace(/age/g, 'gender'), 1);

// Make submissions for the second Datasets
await submitToForm(service, 'alice', 1, 'employees', testData.instances.simpleEntity.two.replace(/simpleEntity|people/g, 'employees'));
await asAlice.patch('/v1/projects/1/forms/employees/submissions/two').send({ reviewState: 'approved' });
await submitToForm(service, 'alice', 1, 'employees2', testData.instances.simpleEntity.three
.replace(/simpleEntity/, 'employees2')
.replace(/people/, 'employees')
.replace(/age/g, 'gender'));
await asAlice.patch('/v1/projects/1/forms/employees2/submissions/three').send({ reviewState: 'approved' });

// Expecting all Submissions should generate Entities
await exhaust(container);
Expand All @@ -1629,11 +1620,9 @@ describe('analytics task queries', function () {
// Make a recent Submissions for the first Dataset
// aaa -> ccc creates unique UUID
await submitToForm(service, 'alice', 1, 'simpleEntity', testData.instances.simpleEntity.two.replace('aaa', 'ccc'));
await asAlice.patch('/v1/projects/1/forms/simpleEntity/submissions/two').send({ reviewState: 'approved' });

// bbb -> xxx causes invalid UUID, hence this Submission should not generate Entity
await submitToForm(service, 'alice', 1, 'simpleEntity', testData.instances.simpleEntity.three.replace('bbb', 'xxx'));
await asAlice.patch('/v1/projects/1/forms/simpleEntity/submissions/three').send({ reviewState: 'approved' });

// One Entity will be created and one error will be logged
await exhaust(container);
Expand All @@ -1643,7 +1632,6 @@ describe('analytics task queries', function () {

// Create new Submission that will cause entity creation error
await submitToForm(service, 'alice', 1, 'simpleEntity', testData.instances.simpleEntity.three.replace(/bbb|three/g, 'xxx'));
await asAlice.patch('/v1/projects/1/forms/simpleEntity/submissions/xxx').send({ reviewState: 'approved' });

// One error will be logged
await exhaust(container);
Expand Down

0 comments on commit f545011

Please sign in to comment.