From cae45fcd87aeeb0f22d4c54814e8bc22cc225e6c Mon Sep 17 00:00:00 2001 From: Christian Georgi Date: Tue, 21 Jun 2022 15:52:40 +0200 Subject: [PATCH] Tests --- fiori/package.json | 1 + package.json | 1 - test/fiori.test.js | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 test/fiori.test.js diff --git a/fiori/package.json b/fiori/package.json index 45465e44..5ea647c1 100644 --- a/fiori/package.json +++ b/fiori/package.json @@ -4,6 +4,7 @@ "dependencies": { "@capire/bookstore": "*", "@sap/cds": ">=5", + "@sap/cds-odata-v2-adapter-proxy": "^1.8.13", "express": "^4.17.1", "passport": ">=0.4.1" }, diff --git a/package.json b/package.json index 49ef6613..f1ee30cf 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "test:hello": "cd hello && npm test" }, "jest": { - "testEnvironment": "node", "testTimeout": 20000, "testMatch": [ "**/*.test.js" diff --git a/test/fiori.test.js b/test/fiori.test.js new file mode 100644 index 00000000..68c65746 --- /dev/null +++ b/test/fiori.test.js @@ -0,0 +1,17 @@ +const cds = require('@sap/cds/lib') +const { GET, expect, axios } = cds.test ('@capire/fiori', '--with-mocks') +axios.defaults.auth = { username: 'alice', password: 'admin' } + +describe('cap/samples - Fiori APIs', () => { + + it('serves $metadata documents in v2', async () => { + const { headers, data } = await GET `/v2/browse/$metadata` + expect(headers).to.contain({ + 'content-type': 'application/xml', + 'dataserviceversion': '2.0', + }) + expect(data).to.contain('') + }) + + +})