Fix tests to use productive cds model
Also remove strange whitespace
This commit is contained in:
@@ -6,9 +6,8 @@ describe('Bookshop: OData Protocol Level Testing', () => {
|
|||||||
const request = require('supertest')(app)
|
const request = require('supertest')(app)
|
||||||
|
|
||||||
it('should serve BooksShop', async () => {
|
it('should serve BooksShop', async () => {
|
||||||
await cds.deploy (__dirname+'/cat-service') .to ('sqlite::memory:')
|
await cds.deploy(__dirname + '/../srv/cat-service').to('sqlite::memory:')
|
||||||
await cds.serve('CatalogService').from(__dirname+'/cat-service') .in (app)
|
await cds.serve('CatalogService').from(__dirname + '/../srv/cat-service').in(app)
|
||||||
//await cds.serve('CatalogService').from(__dirname+'/../srv') .in (app)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Service $metadata document', async () => {
|
it('Service $metadata document', async () => {
|
||||||
@@ -92,18 +91,17 @@ describe('Bookshop: OData Protocol Level Testing', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Bookshop: CDS Service Level Testing', () => {
|
describe('Bookshop: CDS Service Level Testing', () => {
|
||||||
let srv, Books
|
let srv, Books
|
||||||
|
|
||||||
test('Should serve bookshop', async () => {
|
test('Should serve bookshop', async () => {
|
||||||
srv = await cds.serve('CatalogService')
|
srv = await cds.serve('CatalogService').from(__dirname + '/../srv/cat-service')
|
||||||
.from(__dirname+'/cat-service')
|
|
||||||
Books = srv.entities.Books
|
Books = srv.entities.Books
|
||||||
expect(Books).toBeDefined()
|
expect(Books).toBeDefined()
|
||||||
})
|
})
|
||||||
|
|
||||||
test('GET all books', async () => {
|
test('GET all books', async () => {
|
||||||
const books = await srv.read (
|
const books = await srv.read(
|
||||||
//Books, b=>{ b.ID, b.title }
|
//Books, b=>{ b.ID, b.title }
|
||||||
Books, b => { b.title }
|
Books, b => { b.title }
|
||||||
)
|
)
|
||||||
@@ -115,5 +113,5 @@ describe('Bookshop: CDS Service Level Testing', () => {
|
|||||||
{ title: 'Eleonora' },
|
{ title: 'Eleonora' },
|
||||||
{ title: 'Catweazle' }
|
{ title: 'Catweazle' }
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
using { sap.capire.bookshop as my } from '../db/schema';
|
|
||||||
|
|
||||||
@path:'/browse'
|
|
||||||
service CatalogService {
|
|
||||||
|
|
||||||
@readonly entity Books as SELECT from my.Books {*,
|
|
||||||
author.name as author
|
|
||||||
} excluding { createdBy, modifiedBy };
|
|
||||||
|
|
||||||
@requires_: 'authenticated-user'
|
|
||||||
@insertonly entity Orders as projection on my.Orders;
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user