Compare commits
38 Commits
openSAP-we
...
openSAP-we
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a1a7b1f2b | ||
|
|
a560e12106 | ||
|
|
3dccfc30f0 | ||
|
|
cc0be09341 | ||
|
|
175a183f27 | ||
|
|
a1d663a717 | ||
|
|
e75cc7a0a5 | ||
|
|
37ed881102 | ||
|
|
a3ab8cd51f | ||
|
|
6c1f06a06c | ||
|
|
e9a18c9938 | ||
|
|
eb5334cafc | ||
|
|
d54b16bd94 | ||
|
|
ba054305a6 | ||
|
|
e89fc1d9bb | ||
|
|
659fe52509 | ||
|
|
4ad21a47d6 | ||
|
|
7b5b2210ae | ||
|
|
c20c1609a7 | ||
|
|
ffc9fbd5f5 | ||
|
|
11957c93d8 | ||
|
|
2ca71b0f7d | ||
|
|
452b442246 | ||
|
|
bf21d0220c | ||
|
|
b65be0cb41 | ||
|
|
c3c778b2be | ||
|
|
c38c5d832c | ||
|
|
5929d22f98 | ||
|
|
4030173bbc | ||
|
|
74ce1a5fd1 | ||
|
|
cbb27132ec | ||
|
|
72a17ffcf7 | ||
|
|
0e2218a5f1 | ||
|
|
fa8a7861d5 | ||
|
|
ceb5487e75 | ||
|
|
c0bce5ae5b | ||
|
|
ad05e2b9db | ||
|
|
b7c2eee961 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -13,3 +13,5 @@ target/
|
|||||||
connection.properties
|
connection.properties
|
||||||
default-env.json
|
default-env.json
|
||||||
packages/messageBox
|
packages/messageBox
|
||||||
|
*.db
|
||||||
|
|
||||||
|
|||||||
18
.vscode/launch.json
vendored
18
.vscode/launch.json
vendored
@@ -9,8 +9,16 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"runtimeExecutable": "npx",
|
"runtimeExecutable": "npx",
|
||||||
"runtimeArgs": ["-n"],
|
"runtimeArgs": [
|
||||||
"args": ["--", "cds", "run", "--with-mocks", "--in-memory?"], // the leading "--" arg ensures it works with as well as without debugging
|
"-n"
|
||||||
|
],
|
||||||
|
"args": [
|
||||||
|
"--",
|
||||||
|
"cds",
|
||||||
|
"run",
|
||||||
|
"--with-mocks",
|
||||||
|
"--in-memory"
|
||||||
|
], // the leading "--" arg ensures it works with as well as without debugging
|
||||||
"cwd": "${workspaceFolder}/packages/${input:service}",
|
"cwd": "${workspaceFolder}/packages/${input:service}",
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"serverReadyAction": {
|
"serverReadyAction": {
|
||||||
@@ -18,7 +26,9 @@
|
|||||||
"uriFormat": "http://localhost:%s",
|
"uriFormat": "http://localhost:%s",
|
||||||
"action": "openExternally"
|
"action": "openExternally"
|
||||||
},
|
},
|
||||||
"skipFiles": ["<node_internals>/**"]
|
"skipFiles": [
|
||||||
|
"<node_internals>/**"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"inputs": [
|
"inputs": [
|
||||||
@@ -36,7 +46,7 @@
|
|||||||
"reviews-service",
|
"reviews-service",
|
||||||
"user-service"
|
"user-service"
|
||||||
],
|
],
|
||||||
"default": "bookstore"
|
"default": "bookshop"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
12
README.md
12
README.md
@@ -11,7 +11,7 @@ In SAP Business Application Studio, open a terminal.
|
|||||||
Then clone the repo with this specific branch:
|
Then clone the repo with this specific branch:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/sap-samples/cloud-cap-samples projects/cloud-cap-samples -b openSAP-week4-unit1-final
|
git clone https://github.com/sap-samples/cloud-cap-samples projects/cloud-cap-samples -b openSAP-week2-unit4567
|
||||||
cd projects/cloud-cap-samples
|
cd projects/cloud-cap-samples
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -20,6 +20,16 @@ In the `cloud-cap-samples` folder run:
|
|||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Cloud Foundry Login
|
||||||
|
This is required later in the demo. In Studio's terminal, execute:
|
||||||
|
```sh
|
||||||
|
cf login
|
||||||
|
```
|
||||||
|
As input, provide
|
||||||
|
- The Cloud Foundry API endpoint, which is usally `https://api.cf.eu10.hana.ondemand.com`. It can be obtained from the Overview page of your Subaccount in Cloud Cockpit.
|
||||||
|
- Your user's email address and password
|
||||||
|
- The name of your trial organization and space
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
Now you're ready to run the samples, for example:
|
Now you're ready to run the samples, for example:
|
||||||
|
|||||||
6253
package-lock.json
generated
6253
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -9,20 +9,18 @@
|
|||||||
"install": "(npm -s run lerna) && lerna bootstrap --hoist",
|
"install": "(npm -s run lerna) && lerna bootstrap --hoist",
|
||||||
"lerna": "npx --no-install lerna -v > /dev/null || npm i lerna --no-save",
|
"lerna": "npx --no-install lerna -v > /dev/null || npm i lerna --no-save",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"bookshop-enhanced": "cds watch packages/bookshop-enhanced",
|
"bookshop": "cds watch packages/bookshop"
|
||||||
"bookshop": "cds watch packages/bookshop",
|
|
||||||
"bookstore": "cds watch packages/bookstore",
|
|
||||||
"products-service": "cds watch packages/products-service",
|
|
||||||
"reviews-service": "cds watch packages/reviews-service"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sap/cds": "^3",
|
"@sap/cds": "^3",
|
||||||
"express": "^4"
|
"express": "^4"
|
||||||
},
|
},
|
||||||
"--add-these-to-devDependencies-for-tests": {
|
"devDependencies": {
|
||||||
"@types/jest": "*",
|
"@types/jest": "*",
|
||||||
"sqlite3": "*",
|
"sqlite3": "*",
|
||||||
"jest": "*"
|
"jest": "*",
|
||||||
|
"supertest": "^4.0.2",
|
||||||
|
"@sap/hdi-deploy": "3.7.0"
|
||||||
},
|
},
|
||||||
"license": "SAP SAMPLE CODE LICENSE"
|
"license": "SAP SAMPLE CODE LICENSE"
|
||||||
}
|
}
|
||||||
|
|||||||
31
packages/bookshop/.vscode/launch.json
vendored
Normal file
31
packages/bookshop/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Run bookshop",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "node",
|
||||||
|
"cwd": "/home/user/projects/cloud-cap-samples/packages/bookshop",
|
||||||
|
"runtimeExecutable": "npx",
|
||||||
|
"runtimeArgs": [
|
||||||
|
"-n"
|
||||||
|
],
|
||||||
|
"args": [
|
||||||
|
"--",
|
||||||
|
"cds",
|
||||||
|
"run",
|
||||||
|
"--in-memory?"
|
||||||
|
],
|
||||||
|
"console": "internalConsole",
|
||||||
|
"internalConsoleOptions": "openOnSessionStart",
|
||||||
|
"skipFiles": [
|
||||||
|
"<node_internals>/**"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"run.config": "{\"handlerId\":\"cap_run_config_handler_id\",\"runnableId\":\"/home/user/projects/cloud-cap-samples/packages/bookshop\"}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<script src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
|
<script src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
|
||||||
data-sap-ui-libs="sap.m, sap.ushell, sap.collaboration, sap.ui.layout"
|
data-sap-ui-libs="sap.m, sap.ushell, sap.collaboration, sap.ui.layout"
|
||||||
data-sap-ui-compatVersion="edge"
|
data-sap-ui-compatVersion="edge"
|
||||||
data-sap-ui-theme="sap_belize"
|
data-sap-ui-theme="sap_fiori_3"
|
||||||
data-sap-ui-frameOptions="allow"
|
data-sap-ui-frameOptions="allow"
|
||||||
></script>
|
></script>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
ID;modifiedAt;createdAt;createdBy;modifiedBy;OrderNo;currency_code;status
|
ID;modifiedAt;createdAt;createdBy;modifiedBy;OrderNo;currency_code
|
||||||
da86efd0-4ba1-4078-b7f0-5c9c530297f7;;2019-01-31;ALICE;;1;EUR;processing
|
7e2f2640-6866-4dcf-8f4d-3027aa831cad;;2019-01-31;john.doe@test.com;;1;EUR
|
||||||
2f2f2640-6866-4dcf-8f4d-3027aa831cad;;2019-03-25;ALICE;;10;EUR;completed
|
64e718c9-ff99-47f1-8ca3-950c850777d4;;2019-01-30;jane.doe@test.com;;2;EUR
|
||||||
64e718c9-ff99-47f1-8ca3-950c850777d4;;2019-01-30;BOB;;2;EUR;processing
|
|
||||||
1af3322d-3cb1-46be-b312-0ae9ec311537;;2019-03-16;BOB;;9;EUR;completed
|
|
||||||
|
@@ -1,16 +1,5 @@
|
|||||||
namespace sap.capire.bookshop;
|
namespace sap.capire.bookshop;
|
||||||
|
using { Currency, managed, cuid } from '@sap/cds/common';
|
||||||
using {
|
|
||||||
Currency,
|
|
||||||
managed,
|
|
||||||
cuid
|
|
||||||
} from '@sap/cds/common';
|
|
||||||
|
|
||||||
type Status : String enum {
|
|
||||||
completed;
|
|
||||||
processing;
|
|
||||||
blocked;
|
|
||||||
}
|
|
||||||
|
|
||||||
entity Books : managed {
|
entity Books : managed {
|
||||||
key ID : Integer;
|
key ID : Integer;
|
||||||
@@ -18,7 +7,7 @@ entity Books : managed {
|
|||||||
descr : localized String(1111);
|
descr : localized String(1111);
|
||||||
author : Association to Authors;
|
author : Association to Authors;
|
||||||
stock : Integer;
|
stock : Integer;
|
||||||
price : Decimal(9, 2);
|
price : Decimal(9,2);
|
||||||
currency : Currency;
|
currency : Currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,22 +18,18 @@ entity Authors : managed {
|
|||||||
dateOfDeath : Date;
|
dateOfDeath : Date;
|
||||||
placeOfBirth : String;
|
placeOfBirth : String;
|
||||||
placeOfDeath : String;
|
placeOfDeath : String;
|
||||||
books : Association to many Books
|
books : Association to many Books on books.author = $self;
|
||||||
on books.author = $self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
entity Orders : cuid, managed {
|
entity Orders : cuid, managed {
|
||||||
OrderNo : String @title : 'Order Number'; //> readable key
|
OrderNo : String @title:'Order Number'; //> readable key
|
||||||
status : Status default 'processing';
|
Items : Composition of many OrderItems on Items.parent = $self;
|
||||||
Items : Composition of many OrderItems
|
total : Decimal(9,2) @readonly;
|
||||||
on Items.parent = $self;
|
|
||||||
total : Decimal(9, 2)@readonly;
|
|
||||||
currency : Currency;
|
currency : Currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity OrderItems : cuid {
|
entity OrderItems : cuid {
|
||||||
parent : Association to Orders;
|
parent : Association to Orders;
|
||||||
book : Association to Books;
|
book : Association to Books;
|
||||||
amount : Integer;
|
amount : Integer;
|
||||||
netAmount : Decimal(9, 2);
|
netAmount : Decimal(9,2);
|
||||||
}
|
}
|
||||||
@@ -6,20 +6,13 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sap/cds": "^3",
|
"@sap/cds": "^3",
|
||||||
"express": "^4",
|
"express": "^4",
|
||||||
"@sap/xb-msg-amqp-v100": "^0.9.35"
|
"hdb": "^0.17.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"sqlite3": "^4.1.1"
|
"jest": "*"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "npx cds run"
|
"start": "npx cds run",
|
||||||
},
|
"test": "jest"
|
||||||
"cds": {
|
|
||||||
"requires": {
|
|
||||||
"API_BUSINESS_PARTNER": {
|
|
||||||
"kind": "odata",
|
|
||||||
"model": "srv/external/API_BUSINESS_PARTNER"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,8 @@ service AdminService @(_requires:'authenticated-user') {
|
|||||||
|
|
||||||
// Enable Fiori Draft for Orders
|
// Enable Fiori Draft for Orders
|
||||||
annotate AdminService.Orders with @odata.draft.enabled;
|
annotate AdminService.Orders with @odata.draft.enabled;
|
||||||
// annotate AdminService.Books with @odata.draft.enabled;
|
|
||||||
|
|
||||||
// Temporary workaround -> https://github.wdf.sap.corp/cap/issues/issues/3121
|
// Temporary workaround -> cap/issues#3121
|
||||||
extend service AdminService with {
|
extend service AdminService with {
|
||||||
entity OrderItems as select from my.OrderItems;
|
entity OrderItems as select from my.OrderItems;
|
||||||
}
|
}
|
||||||
|
|||||||
22
packages/bookshop/srv/admin-service.js
Normal file
22
packages/bookshop/srv/admin-service.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
const cds = require('@sap/cds')
|
||||||
|
|
||||||
|
/** Service implementation for AdminService */
|
||||||
|
module.exports = cds.service.impl(srv => {
|
||||||
|
const { OrderItems } = srv.entities ('sap.capire.bookshop')
|
||||||
|
|
||||||
|
srv.after (['READ','EDIT'], 'Orders', _calculateTotals)
|
||||||
|
|
||||||
|
// on-the-fly calculate the total Order price based on the OrderItems' netAmounts
|
||||||
|
async function _calculateTotals (orders, req) {
|
||||||
|
const ordersByID = Array.isArray(orders)
|
||||||
|
? orders.reduce ((all,o) => { (all[o.ID] = o).total=0; return all },{})
|
||||||
|
: { [orders.ID]: orders }
|
||||||
|
return cds.transaction(req) .run (
|
||||||
|
SELECT.from(OrderItems) .columns ('parent_ID', 'netAmount')
|
||||||
|
.where ({ parent_ID: {in: Object.keys(ordersByID)} })
|
||||||
|
) .then (items =>
|
||||||
|
items.forEach (item => ordersByID [item.parent_ID] .total += item.netAmount)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using { sap.capire.bookshop as my } from '../db/schema';
|
using { sap.capire.bookshop as my } from '../db/schema';
|
||||||
|
|
||||||
@path:'/browse'
|
@path:'/browse'
|
||||||
|
// @impl: './cat-service.js'
|
||||||
service CatalogService {
|
service CatalogService {
|
||||||
|
|
||||||
@readonly entity Books as SELECT from my.Books {*,
|
@readonly entity Books as SELECT from my.Books {*,
|
||||||
|
|||||||
@@ -1,26 +1,28 @@
|
|||||||
const cds = require('@sap/cds')
|
const cds = require('@sap/cds')
|
||||||
|
const { Books } = cds.entities
|
||||||
|
|
||||||
/** Service implementation for CatalogService */
|
/** Service implementation for CatalogService */
|
||||||
module.exports = cds.service.impl(function () {
|
module.exports = cds.service.impl(srv => {
|
||||||
const { Books, Orders } = this.entities
|
srv.after ('READ', 'Books', each => each.stock > 111 && _addDiscount2(each,11))
|
||||||
this.after('READ', Books, each => each.stock > 111 && _addDiscount2(each, 11))
|
srv.before ('CREATE', 'Orders', _reduceStock)
|
||||||
this.before('CREATE', Orders, _reduceStock)
|
// srv.before ('*', (req) => { console.debug ('>>>', req.method, req.target.name) })
|
||||||
|
|
||||||
/** Add some discount for overstocked books */
|
|
||||||
function _addDiscount2(each, discount) {
|
|
||||||
each.title += ` -- ${discount}% discount!`
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Reduce stock of ordered books if available stock suffices */
|
|
||||||
async function _reduceStock(req) {
|
|
||||||
const { Items: OrderItems } = req.data
|
|
||||||
return cds.transaction(req).run(() => OrderItems.map(order =>
|
|
||||||
UPDATE(Books).set('stock -=', order.amount)
|
|
||||||
.where('ID =', order.book_ID).and('stock >=', order.amount)
|
|
||||||
)).then(all => all.forEach((affectedRows, i) => {
|
|
||||||
if (affectedRows === 0) req.error(409,
|
|
||||||
`${OrderItems[i].amount} exceeds stock for book #${OrderItems[i].book_ID}`
|
|
||||||
)
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/** Add some discount for overstocked books */
|
||||||
|
function _addDiscount2 (each,discount) {
|
||||||
|
each.title += ` -- ${discount}% discount!`
|
||||||
|
}
|
||||||
|
/** Reduce stock of ordered books if available stock suffices */
|
||||||
|
async function _reduceStock (req) {
|
||||||
|
const { Items: orderItems } = req.data
|
||||||
|
|
||||||
|
return cds.transaction(req) .run (()=> orderItems.map (item =>
|
||||||
|
UPDATE (Books)
|
||||||
|
.set ('stock -=', item.amount)
|
||||||
|
.where ('ID =', item.book_ID) .and ('stock >=', item.amount)
|
||||||
|
)).then (all => all.forEach ((affectedRows,i) => {
|
||||||
|
if (affectedRows === 0) {
|
||||||
|
req.error (409, `${orderItems[i].amount} exceeds stock for book #${orderItems[i].book_ID}`)
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|||||||
2426
packages/bookshop/srv/external/API_BUSINESS_PARTNER.csn
vendored
2426
packages/bookshop/srv/external/API_BUSINESS_PARTNER.csn
vendored
File diff suppressed because it is too large
Load Diff
3261
packages/bookshop/srv/external/API_BUSINESS_PARTNER.edmx
vendored
3261
packages/bookshop/srv/external/API_BUSINESS_PARTNER.edmx
vendored
File diff suppressed because it is too large
Load Diff
79
packages/bookshop/tests/bookshop.test.js
Normal file
79
packages/bookshop/tests/bookshop.test.js
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
|
||||||
|
const cds = require('@sap/cds')
|
||||||
|
|
||||||
|
describe('Bookshop: OData Protocol Level Testing', () => {
|
||||||
|
jest.setTimeout(20*1000)
|
||||||
|
const app = require('express')()
|
||||||
|
const request = require('supertest')(app)
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
await cds.deploy(__dirname + '/../srv/cat-service').to('sqlite::memory:')
|
||||||
|
await cds.serve('CatalogService').from(__dirname + '/../srv/cat-service').in(app)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Service $metadata document', async () => {
|
||||||
|
const response = await request
|
||||||
|
.get('/browse/$metadata')
|
||||||
|
.expect('Content-Type', /^application\/xml/)
|
||||||
|
.expect(200)
|
||||||
|
|
||||||
|
const expectedVersion = '<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">'
|
||||||
|
const expectedBooksEntitySet = '<EntitySet Name="Books" EntityType="CatalogService.Books">'
|
||||||
|
expect(response.text.includes(expectedVersion)).toBeTruthy()
|
||||||
|
expect(response.text.includes(expectedBooksEntitySet)).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
it('Get with select, expand and localized', async () => {
|
||||||
|
const response = await request
|
||||||
|
.get('/browse/Books?$select=title,author&$expand=currency')
|
||||||
|
.set('Accept-Language', 'de')
|
||||||
|
.expect('Content-Type', /^application\/json/)
|
||||||
|
.expect(200)
|
||||||
|
|
||||||
|
expect(response.body.value).toMatchObject([
|
||||||
|
{
|
||||||
|
ID: 201, title: "Sturmhöhe", author: "Emily Brontë",
|
||||||
|
currency: { name: "Pfund", descr: "Britische Pfund", code: "GBP", symbol: "£" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ID: 207, title: "Jane Eyre", author: "Charlotte Brontë",
|
||||||
|
currency: { name: "Pfund", descr: "Britische Pfund", code: "GBP", symbol: "£" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ID: 251, title: "The Raven", author: "Edgar Allen Poe",
|
||||||
|
currency: { name: "US-Dollar", descr: "United States Dollar", code: "USD", symbol: "$" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ID: 252, title: "Eleonora", author: "Edgar Allen Poe",
|
||||||
|
currency: { name: "US-Dollar", descr: "United States Dollar", code: "USD", symbol: "$" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ID: 271, title: "Catweazle", author: "Richard Carpenter",
|
||||||
|
currency: { name: "Euro", descr: "European Euro", code: "EUR", symbol: "€" }
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('Bookshop: CDS Service Level Testing', () => {
|
||||||
|
let srv, Books
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
srv = await cds.serve('CatalogService').from(__dirname + '/../srv/cat-service')
|
||||||
|
Books = srv.entities.Books
|
||||||
|
expect(Books).toBeDefined()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('GETs all books', async () => {
|
||||||
|
const books = await srv.read(Books, b => { b.title })
|
||||||
|
|
||||||
|
expect(books).toMatchObject([
|
||||||
|
{ title: 'Wuthering Heights' },
|
||||||
|
{ title: 'Jane Eyre' },
|
||||||
|
{ title: 'The Raven' },
|
||||||
|
{ title: 'Eleonora' },
|
||||||
|
{ title: 'Catweazle' }
|
||||||
|
])
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user