Test cosmetics, remove obsolete stuff
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
"hdb": "^0.17.1"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npx cds run"
|
||||
"start": "npx cds run",
|
||||
"test": "../../node_modules/.bin/jest"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,17 +94,14 @@ describe('Bookshop: OData Protocol Level Testing', () => {
|
||||
describe('Bookshop: CDS Service Level Testing', () => {
|
||||
let srv, Books
|
||||
|
||||
test('Should serve bookshop', async () => {
|
||||
it('Should serve bookshop', async () => {
|
||||
srv = await cds.serve('CatalogService').from(__dirname + '/../srv/cat-service')
|
||||
Books = srv.entities.Books
|
||||
expect(Books).toBeDefined()
|
||||
})
|
||||
|
||||
test('GET all books', async () => {
|
||||
const books = await srv.read(
|
||||
//Books, b=>{ b.ID, b.title }
|
||||
Books, b => { b.title }
|
||||
)
|
||||
it('GETs all books', async () => {
|
||||
const books = await srv.read(Books, b => { b.title })
|
||||
|
||||
expect(books).toMatchObject([
|
||||
{ title: 'Wuthering Heights' },
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
##########################################
|
||||
# Test bookstore
|
||||
##########################################
|
||||
|
||||
@PORT = 4004
|
||||
@HOST = localhost
|
||||
#######
|
||||
# List books
|
||||
#######
|
||||
|
||||
GET http://{{HOST}}:{{PORT}}/browse/Books HTTP/1.1
|
||||
|
||||
### List Books with their current stocks via Browse service
|
||||
### title containts "discount" info due to custom handler in cat-service.js
|
||||
GET http://{{HOST}}:{{PORT}}/browse/Books?$select=ID,title,stock
|
||||
|
||||
### List Books with their current stocks via Admin service
|
||||
### title DOES NOT containt "discount" info as there is no custom handler for admin service
|
||||
# skip admin service
|
||||
# GET http://{{HOST}}:{{PORT}}/admin/Books?$select=ID,title,stock
|
||||
|
||||
### List all Orders
|
||||
GET http://{{HOST}}:{{PORT}}/admin/Orders?&$expand=Items
|
||||
|
||||
#######
|
||||
# Create order
|
||||
#######
|
||||
# Sending this three times should result in a 409: 5 exceeds stock for book #201
|
||||
POST http://{{HOST}}:{{PORT}}/browse/Orders HTTP/1.1
|
||||
Content-Type: application/json;IEEE754Compatible=true
|
||||
|
||||
{ "OrderNo":"2019-09...", "Items":[
|
||||
{ "book_ID":201, "amount":3 },
|
||||
{ "book_ID":207, "amount":3 }
|
||||
]}
|
||||
|
||||
|
||||
#######
|
||||
# Delete order not allowed due to annotation @insertonly in cat-service.cds
|
||||
#######
|
||||
DELETE http://{{HOST}}:{{PORT}}//browse/Orders/7e2f2640-6866-4dcf-8f4d-3027aa831cad HTTP/1.1
|
||||
|
||||
|
||||
#######
|
||||
# List order not allowed due to @insertonly
|
||||
#######
|
||||
GET http://{{HOST}}:{{PORT}}//browse/Orders HTTP/1.1
|
||||
@@ -1,23 +0,0 @@
|
||||
const cds = require('@sap/cds/lib/cds')
|
||||
const run = require('@sap/cds/bin/run')
|
||||
|
||||
let testServer
|
||||
const cwd = process.cwd()
|
||||
|
||||
const setup = (model, done) => {
|
||||
cds.once('listening', ({ server }) => {
|
||||
testServer = server
|
||||
done()
|
||||
})
|
||||
run([model], { 'in-memory?': true })
|
||||
}
|
||||
|
||||
const close = done => {
|
||||
testServer.close(done)
|
||||
process.chdir(cwd)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
setup,
|
||||
close
|
||||
}
|
||||
Reference in New Issue
Block a user