Skip to content

Commit

Permalink
Fix integration tests (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnkiefer authored Oct 11, 2023
1 parent 734ac1c commit 9271d3f
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 4 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Tests

on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:

jobs:
test:
strategy:
matrix:
version: [20, 18]
platform: [ macos-latest, ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.version }}

- name: Run Tests
run: |
npm install
npm run test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
node_modules/
2 changes: 1 addition & 1 deletion cds-plugin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const cds = require('@sap/cds/lib')
const cds = require('@sap/cds')

const isChangeTracked = (entity) => (
entity['@changelog'] || entity['@changelog.keys']
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"scripts": {
"build": "cds build",
"start": "cds run",
"test": "npx jest"
"test": "npx jest --silent"
},
"devDependencies": {
"@cap-js/sqlite": "*",
Expand Down
4 changes: 2 additions & 2 deletions tests/bookshop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependencies": {
"@cap-js/change-tracking": "*"
"devDependencies": {
"@cap-js/sqlite": "*"
},
"cds": {
"requires": {
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/fiori-draft-disabled.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ const cds = require("@sap/cds");
const bookshop = require("path").resolve(__dirname, "./../bookshop");
const { expect, data, POST, PATCH, DELETE } = cds.test(bookshop);

// REVISIT: should be easier to load the plugin and its model
cds.env.plugins["@cap-js/change-tracking"] = {
"impl": require("path").join(__dirname, "../../cds-plugin.js")
}
cds.env.roots.push("../../");

jest.setTimeout(5 * 60 * 1000);

let adminService = null;
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/fiori-draft-enabled.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ const bookshop = require("path").resolve(__dirname, "./../bookshop");
const { expect, data, POST, PATCH, DELETE } = cds.test(bookshop);
const { RequestSend } = require("../utils/api");

// REVISIT: should be easier to load the plugin and its model
cds.env.plugins["@cap-js/change-tracking"] = {
"impl": require("path").join(__dirname, "../../cds-plugin.js")
}
cds.env.roots.push("../../");

jest.setTimeout(5 * 60 * 1000);

let adminService = null;
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/service-api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ const cds = require("@sap/cds");
const bookshop = require("path").resolve(__dirname, "./../bookshop");
const { expect, data } = cds.test(bookshop);

// REVISIT: should be easier to load the plugin and its model
cds.env.plugins["@cap-js/change-tracking"] = {
"impl": require("path").join(__dirname, "../../cds-plugin.js")
}
cds.env.roots.push("../../");

jest.setTimeout(5 * 60 * 1000);

let adminService = null;
Expand Down

0 comments on commit 9271d3f

Please sign in to comment.