Compare commits

...

13 Commits

Author SHA1 Message Date
Daniel
98577c1ecc re cap 2020-05-15 09:00:56 +02:00
Daniel
e8cd0e3231 Samples for re:cap 2020-05-15 08:37:40 +02:00
Christian Georgi
0a552b4346 Try with other node 12 version 2020-05-14 21:50:30 +02:00
Christian Georgi
6367081e9d CI badge 2020-05-14 21:19:18 +02:00
Christian Georgi
3e73683d99 Rename job 2020-05-14 21:05:26 +02:00
Christian Georgi
2b345ca447 Remove call to build script 2020-05-14 21:05:26 +02:00
Christian Georgi
20593f2fa2 Workflow file for node.js 2020-05-14 20:46:17 +02:00
Vitaly Kozyura
ca45aa1cf7 Merge pull request #74 from SAP-samples/temporary-skip-test
Temporary disable test
2020-05-07 09:59:39 +02:00
Christian Georgi
e408836c2a Fix typo in bootstrap event 2020-05-06 18:33:16 +02:00
D051920
3000a9e2df Temporary disable test 2020-05-06 18:13:40 +02:00
Heiko Witteborg
b83236de2a Merge pull request #73 from SAP-samples/add-test-for-subselect
add test for subselect in query api as documented
2020-05-06 13:03:50 +02:00
d045778
46b3b8aaec add test for subselect in query api as documented 2020-05-06 11:52:30 +02:00
Iwona Hahn
59f5c82684 Cosmetics 2020-05-05 15:01:53 +02:00
10 changed files with 98 additions and 7 deletions

9
.env
View File

@@ -1 +1,8 @@
cds.features.snapi = y
cds.features.snapi = true
cds.odata.version = v4
cds.odata.containment = true
cds.odata.proxies = true
cds.odata.format = structured
cds.cdsc.beta.uniqueconstraints = true
cds.cdsc.beta.aspectCompositions = true
cds.cdsc.severities.unexpected-key = info

28
.github/workflows/node.js.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.16.2]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test

View File

@@ -2,6 +2,7 @@
Find here a collection of samples for the [SAP Cloud Application Programming Model](https://cap.cloud.sap) organized in a simplistic [monorepo setup](samples.md#all-in-one-monorepo). → See [**Overview** of contained samples](samples.md)
![](https://github.com/SAP-samples/cloud-cap-samples/workflows/CI/badge.svg)
### Preliminaries
@@ -39,19 +40,19 @@ After that open this link in your browser: [http://localhost:4004](http://localh
### Testing
Run the provided tests with [_jest_](http://jestjs.io) or [_mocha_](http://mochajs.org), e.g.:
Run the provided tests with [_jest_](http://jestjs.io) or [_mocha_](http://mochajs.org), for example:
```sh
npx jest
```
> While mocha is a bit smaller and faster, jest runs tests in parallel and isolation which allows to run all tests.
> While mocha is a bit smaller and faster, jest runs tests in parallel and isolation, which allows to run all tests.
## Get Support
Check out the cap docs at [https://cap.cloud.sap](https://cap.cloud.sap). <br>
Check out the documentation at [https://cap.cloud.sap](https://cap.cloud.sap). <br>
In case you find a bug or need support, please [open an issue in here](https://github.com/SAP-samples/cloud-cap-samples/issues/new).
## License
Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, version 2.0 except as noted otherwise in the [LICENSE](/LICENSE) file.
Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, version 2.0 except as noted otherwise in the [LICENSE](/LICENSE) file.

8
orders/.env Normal file
View File

@@ -0,0 +1,8 @@
cds.features.snapi = true
cds.odata.version = v4
cds.odata.containment = true
cds.odata.proxies = true
cds.odata.format = structured
cds.cdsc.beta.uniqueconstraints = true
cds.cdsc.beta.aspectCompositions = true
cds.cdsc.severities.unexpected-key = info

View File

@@ -0,0 +1,5 @@
using { sap.capire.bookshop.Authors } from '@capire/bookshop';
define view Foo as select from Authors {
ID, name, books[where title like 'Cat%'].currency.code
};

View File

@@ -0,0 +1,27 @@
using { User, cuid, managed } from '@sap/cds/common';
// Looks like inheritance, but isn't
entity Foo @bar : cuid, managed { bar:Car; }
// It's just syntactical sugar for Aspects
entity Boo {}
extend Boo with cuid;
extend Boo with managed;
extend Boo with { bar:Car; }
annotate Boo with @bar;
// There's close to no limits
entity Moo : Foo {}
entity Zoo {}; extend Zoo with Foo;
// This one will apply to all uses above
type Car : String;
annotate Car with @car;
// And these to all uses here and wherever else
extend managed with {
notes : String;
}
// CDS is built with CDS
annotate cds.UUID with @odata.Type: 'Edm.Integer';

10
recap/extending-views.cds Normal file
View File

@@ -0,0 +1,10 @@
using { CatalogService } from '@capire/bookshop';
extend sap.capire.bookshop.Books with {
ISBN : String;
}
/** your docs go here */
extend projection CatalogService.Books with {
ISBN
}

View File

@@ -34,7 +34,7 @@ cds.once('served', async()=>{
// Other bootstrapping events you could hook in to...
/* eslint-disable no-unused-vars */
cds.on('boostrap',(app) => {/* ... */})
cds.on('bootstrap',(app) => {/* ... */})
cds.on('loaded', (model) => {/* ... */})
cds.on('connect', (srv) => {/* ... */})
cds.on('serving', (srv) => {/* ... */})

View File

@@ -359,6 +359,11 @@ describe('cds.ql → cqn', () => {
CQL`SELECT from Foo where x in (SELECT y from Bar)`
)
// using query api
expect(SELECT.from('Books').where(
`author.name in`, SELECT('name').from('Authors'))).to.eql(CQL`SELECT from Books where author.name in (SELECT name from Authors)`
)
// in classical semi joins
expect(
SELECT('x').from(Foo) .where ( `exists`,

View File

@@ -72,7 +72,7 @@ describe('Localized Data', () => {
])
})
it('supports @cds.localized:false', async ()=>{
xit('supports @cds.localized:false', async ()=>{
const { data } = await GET(`/browse/BooksSans?&$select=title,localized_title&$expand=currency&$filter=locale eq 'de' or locale eq null`, {
headers: { 'Accept-Language': 'de' },
})