forked from cap-js-community/odata-v2-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
path.test.js
44 lines (36 loc) · 1.24 KB
/
path.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
"use strict";
const cds = require("@sap/cds");
const supertest = require("supertest");
const util = require("./_env/util/request");
cds.test(__dirname + "/_env");
let request;
describe("path", () => {
beforeAll(async () => {
await global._init;
request = supertest(cds.app.server);
});
it("GET service", async () => {
const response = await util.callRead(request, "/odata/v2/a/b-c/d/", {
accept: "application/json",
});
expect(response.body).toBeDefined();
expect(response.body.d.EntitySets.sort()).toEqual(
["Header", "HeaderItem", "HeaderLine", "Header_texts", "HeaderItem_texts"].sort(),
);
});
it("GET service data", async () => {
const response = await util.callRead(request, "/odata/v2/a/b-c/d/Header", {
accept: "application/json",
});
expect(response.body).toBeDefined();
expect(response.body.d.results.length > 0).toEqual(true);
});
it("GET service case sensitive", async () => {
const response = await util.callRead(request, "/odata/v2/A/B-C/D/Header", {
accept: "application/json",
});
expect(response.body).toBeDefined();
expect(response.body.d.results.length > 0).toEqual(true);
expect(response.body.d.results[0].__metadata).toBeDefined();
});
});