Skip to content

Commit 2d642f0

Browse files
committed
use DB uuid type for entity uuids: use valid uuids in tests
1 parent d210ccc commit 2d642f0

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

test/integration/api/entities.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,14 @@ describe('Entities API', () => {
244244
it('should return notfound if the dataset does not exist', testEntities(async (service) => {
245245
const asAlice = await service.login('alice');
246246

247-
await asAlice.get('/v1/projects/1/datasets/nonexistent/entities/123')
247+
await asAlice.get('/v1/projects/1/datasets/nonexistent/entities/00000000-0000-4000-8000-000000000000')
248248
.expect(404);
249249
}));
250250

251251
it('should return notfound if the entity does not exist', testEntities(async (service) => {
252252
const asAlice = await service.login('alice');
253253

254-
await asAlice.get('/v1/projects/1/datasets/people/entities/123')
254+
await asAlice.get('/v1/projects/1/datasets/people/entities/00000000-0000-4000-8000-000000000000')
255255
.expect(404);
256256
}));
257257

@@ -496,7 +496,7 @@ describe('Entities API', () => {
496496
it('should return notfound if the entity does not exist', testEntities(async (service) => {
497497
const asAlice = await service.login('alice');
498498

499-
await asAlice.get('/v1/projects/1/datasets/people/entities/123/versions')
499+
await asAlice.get('/v1/projects/1/datasets/people/entities/00000000-0000-4000-8000-000000000000/versions')
500500
.expect(404);
501501
}));
502502

@@ -815,7 +815,7 @@ describe('Entities API', () => {
815815
it('should return notfound if the entity does not exist', testEntities(async (service) => {
816816
const asAlice = await service.login('alice');
817817

818-
await asAlice.get('/v1/projects/1/datasets/people/entities/123/diffs')
818+
await asAlice.get('/v1/projects/1/datasets/people/entities/00000000-0000-4000-8000-000000000000/diffs')
819819
.expect(404);
820820
}));
821821

@@ -872,7 +872,7 @@ describe('Entities API', () => {
872872
it('should return notfound if the entity does not exist', testEntities(async (service) => {
873873
const asAlice = await service.login('alice');
874874

875-
await asAlice.get('/v1/projects/1/datasets/people/entities/123/audits')
875+
await asAlice.get('/v1/projects/1/datasets/people/entities/00000000-0000-4000-8000-000000000000/audits')
876876
.expect(404);
877877
}));
878878

@@ -1539,19 +1539,19 @@ describe('Entities API', () => {
15391539
describe('PATCH /datasets/:name/entities/:uuid', () => {
15401540
it('should return notfound if the dataset does not exist', testEntities(async (service) => {
15411541
const asAlice = await service.login('alice');
1542-
await asAlice.patch('/v1/projects/1/datasets/nonexistent/entities/123')
1542+
await asAlice.patch('/v1/projects/1/datasets/nonexistent/entities/00000000-0000-4000-8000-000000000000')
15431543
.expect(404);
15441544
}));
15451545

15461546
it('should return notfound if the entity does not exist', testEntities(async (service) => {
15471547
const asAlice = await service.login('alice');
1548-
await asAlice.patch('/v1/projects/1/datasets/people/entities/123')
1548+
await asAlice.patch('/v1/projects/1/datasets/people/entities/00000000-0000-4000-8000-000000000000')
15491549
.expect(404);
15501550
}));
15511551

15521552
it('should reject if the user cannot update', testEntities(async (service) => {
15531553
const asChelsea = await service.login('chelsea');
1554-
await asChelsea.patch('/v1/projects/1/datasets/people/entities/123')
1554+
await asChelsea.patch('/v1/projects/1/datasets/people/entities/00000000-0000-4000-8000-000000000000')
15551555
.expect(403);
15561556
}));
15571557

@@ -2111,14 +2111,14 @@ describe('Entities API', () => {
21112111
it('should return notfound if the dataset does not exist', testEntities(async (service) => {
21122112
const asAlice = await service.login('alice');
21132113

2114-
await asAlice.delete('/v1/projects/1/datasets/nonexistent/entities/123')
2114+
await asAlice.delete('/v1/projects/1/datasets/nonexistent/entities/00000000-0000-4000-8000-000000000000')
21152115
.expect(404);
21162116
}));
21172117

21182118
it('should return notfound if the entity does not exist', testEntities(async (service) => {
21192119
const asAlice = await service.login('alice');
21202120

2121-
await asAlice.delete('/v1/projects/1/datasets/people/entities/123')
2121+
await asAlice.delete('/v1/projects/1/datasets/people/entities/00000000-0000-4000-8000-000000000000')
21222122
.expect(404);
21232123
}));
21242124

@@ -2175,7 +2175,7 @@ describe('Entities API', () => {
21752175
it('should reject if the entity does not exist', testEntities(async (service) => {
21762176
const asAlice = await service.login('alice');
21772177

2178-
await asAlice.post('/v1/projects/1/datasets/people/entities/nonexistant/restore')
2178+
await asAlice.post('/v1/projects/1/datasets/people/entities/00000000-0000-0000-0000-000000000000/restore')
21792179
.expect(404);
21802180
}));
21812181

@@ -2976,7 +2976,7 @@ describe('Entities API', () => {
29762976

29772977
await asAlice.post('/v1/projects/1/datasets/people/entities/bulk-delete')
29782978
.send({
2979-
ids: ['12345678-1234-4123-8234-nonexistent']
2979+
ids: ['12345678-1234-4123-8234-0123456789ab']
29802980
})
29812981
.expect(200)
29822982
.then(({ body }) => {
@@ -3087,7 +3087,7 @@ describe('Entities API', () => {
30873087

30883088
await asAlice.post('/v1/projects/1/datasets/people/entities/bulk-restore')
30893089
.send({
3090-
ids: ['12345678-1234-4123-8234-nonexistent']
3090+
ids: ['12345678-1234-4123-8234-0123456789ab']
30913091
})
30923092
.expect(200)
30933093
.then(({ body }) => {
@@ -3168,7 +3168,7 @@ describe('Entities API', () => {
31683168
// Try to restore both a valid deleted entity and a nonexistent one
31693169
await asAlice.post('/v1/projects/1/datasets/people/entities/bulk-restore')
31703170
.send({
3171-
ids: ['12345678-1234-4123-8234-123456789abc', '12345678-1234-4123-8234-nonexistent']
3171+
ids: ['12345678-1234-4123-8234-123456789abc', '12345678-1234-4123-8234-0123456789ab']
31723172
})
31733173
.expect(200)
31743174
.then(({ body }) => {

test/integration/task/purge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ describe('task: purge deleted resources (forms, submissions and entities)', () =
261261
})));
262262

263263
it('should call entities purge if entities uuid is specified', testTask(() =>
264-
purgeTask({ entityUuid: 'abc', projectId: 1, datasetName: 'people' })
264+
purgeTask({ entityUuid: '00000000-0000-4000-8000-000000000000', projectId: 1, datasetName: 'people' })
265265
.then((message) => {
266266
message.should.equal('Entities purged: 0');
267267
})));

0 commit comments

Comments
 (0)