Skip to content

Commit 9271d3f

Browse files
authored
Fix integration tests (#18)
1 parent 734ac1c commit 9271d3f

File tree

8 files changed

+50
-4
lines changed

8 files changed

+50
-4
lines changed

.github/workflows/main.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Tests
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test:
12+
strategy:
13+
matrix:
14+
version: [20, 18]
15+
platform: [ macos-latest, ubuntu-latest, windows-latest ]
16+
runs-on: ${{ matrix.platform }}
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: actions/setup-node@v3
21+
with:
22+
node-version: ${{ matrix.version }}
23+
24+
- name: Run Tests
25+
run: |
26+
npm install
27+
npm run test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.DS_Store
2+
node_modules/

cds-plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const cds = require('@sap/cds/lib')
1+
const cds = require('@sap/cds')
22

33
const isChangeTracked = (entity) => (
44
entity['@changelog'] || entity['@changelog.keys']

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"scripts": {
1212
"build": "cds build",
1313
"start": "cds run",
14-
"test": "npx jest"
14+
"test": "npx jest --silent"
1515
},
1616
"devDependencies": {
1717
"@cap-js/sqlite": "*",

tests/bookshop/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"dependencies": {
3-
"@cap-js/change-tracking": "*"
2+
"devDependencies": {
3+
"@cap-js/sqlite": "*"
44
},
55
"cds": {
66
"requires": {

tests/integration/fiori-draft-disabled.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ const cds = require("@sap/cds");
22
const bookshop = require("path").resolve(__dirname, "./../bookshop");
33
const { expect, data, POST, PATCH, DELETE } = cds.test(bookshop);
44

5+
// REVISIT: should be easier to load the plugin and its model
6+
cds.env.plugins["@cap-js/change-tracking"] = {
7+
"impl": require("path").join(__dirname, "../../cds-plugin.js")
8+
}
9+
cds.env.roots.push("../../");
10+
511
jest.setTimeout(5 * 60 * 1000);
612

713
let adminService = null;

tests/integration/fiori-draft-enabled.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ const bookshop = require("path").resolve(__dirname, "./../bookshop");
33
const { expect, data, POST, PATCH, DELETE } = cds.test(bookshop);
44
const { RequestSend } = require("../utils/api");
55

6+
// REVISIT: should be easier to load the plugin and its model
7+
cds.env.plugins["@cap-js/change-tracking"] = {
8+
"impl": require("path").join(__dirname, "../../cds-plugin.js")
9+
}
10+
cds.env.roots.push("../../");
11+
612
jest.setTimeout(5 * 60 * 1000);
713

814
let adminService = null;

tests/integration/service-api.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ const cds = require("@sap/cds");
22
const bookshop = require("path").resolve(__dirname, "./../bookshop");
33
const { expect, data } = cds.test(bookshop);
44

5+
// REVISIT: should be easier to load the plugin and its model
6+
cds.env.plugins["@cap-js/change-tracking"] = {
7+
"impl": require("path").join(__dirname, "../../cds-plugin.js")
8+
}
9+
cds.env.roots.push("../../");
10+
511
jest.setTimeout(5 * 60 * 1000);
612

713
let adminService = null;

0 commit comments

Comments
 (0)