Skip to content

Commit

Permalink
Fix missing test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
daogrady committed Feb 24, 2025
1 parent 1d86d43 commit 8a7385e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@
"README.md"
],
"scripts": {
"test:runtime": "npx tsc test/typescript/runtime.test.ts --target ES2020 --module commonjs && node --test './test/typescript/runtime.test.js'; rm test/typescript/runtime.test.js",
"test:api-calls": "node --test './test/typescript/apis/cds-api-calls.test.js'",
"test:typings": "node --test './test/typescript/cds-typings.test.js'",
"test:all": "npm run test:runtime && npm run test:api-calls && npm run test:typings",
"test:setup": "npm install file:. --no-save --force && npm run prerelease:ci-fix",
"test": "npm run test:setup && npm run test:rollup-on",
"test:rollup-on": "npm run rollup && npm run rollup:on && jest --silent",
"test:rollup-off": "npm run rollup:off && jest --silent",
"test:rollup-on": "npm run rollup && npm run rollup:on && npm run test:all --silent",
"test:rollup-off": "npm run rollup:off && npm run test:all --silent",
"test:integration": "jest --testMatch \"**/test/**/*.integrationtest.js\"",
"rollup": "rm -rf dist/ && mkdir -p etc/ && npx -y @microsoft/api-extractor run --local --verbose && .github/rollup-patch.js",
"rollup:on": "npm pkg set typings=dist/cds-types.d.ts && [ -d 'apis' ] && mv -- apis -apis || true",
Expand Down
11 changes: 6 additions & 5 deletions test/typescript/runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,12 @@ describe('runtime tests', () => {

cds.env.requires.db = { kind: 'sqlite' }
// let { Books } = cds.entities

expect (Service && cds.Service).toBe(Service)
expect (Request && cds.Request).toBe(Request)
expect (Event && cds.Event).toBe(Event)
expect (User && cds.User).toBe(User)
// classes are functions. .toBe therefore incorrectly tries to invoke the argument
// -> working around that by wrapping the class in an actual function to invoke
expect (Service && cds.Service).toBe(()=>Service)
expect (Request && cds.Request).toBe(()=>Request)
expect (Event && cds.Event).toBe(()=>Event)
expect (User && cds.User).toBe(()=>User)
expect (cds.linked)

class MyService extends cds.ApplicationService {}
Expand Down

0 comments on commit 8a7385e

Please sign in to comment.