cds.events test

This commit is contained in:
Daniel
2021-06-04 11:34:52 +02:00
committed by Uwe Klinger
parent d9d7203e49
commit c8c10b7c8a
2 changed files with 28 additions and 0 deletions

22
test/cds.events.test.js Normal file
View File

@@ -0,0 +1,22 @@
const cds = require ('@sap/cds/lib')
const { expect } = cds.test.in (__dirname)
describe('cds.events tests', ()=>{
let m; before (async ()=> m = await cds.load('events.cds'))
it ('should have the model loaded', ()=>{
expect(m.definitions).to.have.property('Sue.Foo')
})
it ('should compile the model to edmx', ()=>{
const edmx = cds.compile(m).to.edmx({service:'Sue'})
expect(edmx).to.match(/<EntitySet Name="Foo" EntityType="Sue.Foo"\/>/)
})
it ('should compile the model to sql', ()=>{
const sql = cds.compile(m).to.sql().join(';\n')
expect(sql).not.to.match(/CREATE TABLE Sue_Foo/)
expect(sql).to.match(/CREATE TABLE Sue_Bar/)
})
})