-
Notifications
You must be signed in to change notification settings - Fork 5
/
batch_operations_create_test.js
45 lines (34 loc) · 1.32 KB
/
batch_operations_create_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const testedResource = require('../common.js').testedResource;
const http = require('../http.js');
const entitiesResource = testedResource + '/entities/';
const batchCreationResource = testedResource + '/entityOperations/create';
describe('Batch Entity Creation. JSON', () => {
const entity1 = {
id: 'urn:ngsi-ld:T:' + new Date().getTime(),
type: 'T'
};
const entity2 = {
id: 'urn:ngsi-ld:T:' + new Date().getTime() + 1,
type: 'T',
P1: {
type: 'Property',
value: 'Hola'
}
};
const entityIds = [encodeURIComponent(entity1.id), encodeURIComponent(entity2.id)];
afterAll(() => {
const requests = [];
for (let j = 0; j < entityIds.length; j++) {
requests.push(http.delete(entitiesResource + entityIds[j]));
}
return Promise.all(requests);
});
// issue is raised in Github https://github.com/FIWARE/context.Orion-LD/issues/303
it('should create a list of entities 001', async function() {
const entities = [entity1, entity2];
const response = await http.post(batchCreationResource, entities);
expect(response.response).toHaveProperty('statusCode', 201);
//no response body
//assertBatchOperation(response, [entities[0].id, entities[1].id], []);
});
});