Sync with cds runtime for next release

This commit is contained in:
Mikhail Goncharov
2022-02-14 12:06:22 +01:00
parent 984ea2133b
commit a7511ed677
2 changed files with 55 additions and 0 deletions

View File

@@ -35,6 +35,21 @@ describe('Hierarchical Data', ()=>{
))
it ('supports nested reads', async()=>{
if (cds.version >= '5.9.0') {
expect (await
SELECT.one.from (Cats, c=>{
c.ID, c.name.as('parent'), c.children (c=>{
c.name.as('child')
})
}) .where ({name:'Cat'})
) .to.eql (
{ ID:101, parent:'Cat', children:[
{ child:'Kitty' },
{ child:'Catwoman' },
]}
)
return
}
expect (await
SELECT.one.from (Cats, c=>{
c.ID, c.name.as('parent'), c.children (c=>{
@@ -50,6 +65,25 @@ describe('Hierarchical Data', ()=>{
})
it ('supports deeply nested reads', async()=>{
if (cds.version >= '5.9.0') {
expect (await SELECT.one.from (Cats, c=>{
c.ID, c.name, c.children (
c => { c.name },
{levels:3}
)
}) .where ({name:'Cat'})
) .to.eql (
{ ID:101, name:'Cat', children:[
{ name:'Kitty', children:[
{ name:'Kitty Cat', children:[
{ name:'Aristocat' }, ]}, // level 3
{ name:'Kitty Bat', children:[] }, ]},
{ name:'Catwoman', children:[
{ name:'Catalina', children:[] } ]},
]}
)
return
}
expect (await SELECT.one.from (Cats, c=>{
c.ID, c.name, c.children (
c => { c.name },