Improve tests to also work with node --test

This commit is contained in:
Daniel Hutzel
2024-05-14 14:37:37 +02:00
parent 0f6809a45b
commit aaa94e2d5f
4 changed files with 84 additions and 87 deletions

View File

@@ -1,13 +1,10 @@
const cds = require ('@sap/cds')
describe('Hello world!', () => {
beforeAll (()=> process.env.CDS_TYPESCRIPT = true)
afterAll (()=> delete process.env.CDS_TYPESCRIPT)
const {GET} = cds.test.in(__dirname,'../srv').run('serve', 'world.cds')
it('should say hello with class impl', async () => {
const {data} = await GET`/say/hello(to='world')`
expect(data.value).toMatch(/Hello world.*typescript.*/i)
expect(data.value).to.match(/Hello world.*typescript.*/i)
})
})