diff --git a/test/integration/api/entities.js b/test/integration/api/entities.js index df4c7df7b..3cef18d14 100644 --- a/test/integration/api/entities.js +++ b/test/integration/api/entities.js @@ -616,30 +616,33 @@ describe('Entities API', () => { }); })); - it('should get version source even when there is no corresponding create/update event', testEntities(async (service, container) => { + it('should get version source with source details even when there is no corresponding submission event', testEntities(async (service) => { const asAlice = await service.login('alice'); - await asAlice.get('/v1/projects/1/datasets/people/entities/12345678-1234-4123-8234-123456789abc/versions') - .expect(200) - .then(({ body: versions }) => { - versions[0].should.have.property('source'); - versions[0].source.submission.instanceId.should.equal('one'); - versions[0].source.submission.should.have.property('currentVersion'); - versions[0].source.event.action.should.equal('submission.update'); + await asAlice.post('/v1/projects/1/datasets/people/entities') + .send({ + source: { + name: 'people.csv', + size: 100, + }, + entities: [ + { + uuid: '12345678-1234-4123-8234-111111111aaa', + label: 'Johnny Doe', + data: { + first_name: 'Johnny', + age: '22' + } + }, + ] }); - // this is simulating an entity version that doesnt have a corresponding create event - // e.g. made through bulk create (coming soon) - // but that can still look up source details directly from source table - await container.run(sql`delete from audits where action = 'entity.create'`); - - await asAlice.get('/v1/projects/1/datasets/people/entities/12345678-1234-4123-8234-123456789abc/versions') + await asAlice.get('/v1/projects/1/datasets/people/entities/12345678-1234-4123-8234-111111111aaa/versions') .expect(200) .then(({ body: versions }) => { versions[0].should.have.property('source'); - versions[0].source.should.eql({ submission: { instanceId: 'one' } }); + versions[0].source.should.eql({ name: 'people.csv', size: 100, count: 1, userAgent: null }); }); - })); describe('relevantToConflict', () => {