Updated tests for 4.2
This commit is contained in:
@@ -15,14 +15,12 @@ describe('Consuming Services locally', () => {
|
|||||||
it('supports targets as strings or reflected defs', async () => {
|
it('supports targets as strings or reflected defs', async () => {
|
||||||
const AdminService = await cds.connect.to('AdminService')
|
const AdminService = await cds.connect.to('AdminService')
|
||||||
const { Authors } = AdminService.entities
|
const { Authors } = AdminService.entities
|
||||||
expect(await AdminService.read(Authors))
|
const _ = expect (await AdminService.read(Authors))
|
||||||
.to.eql(await AdminService.read('Authors'))
|
.to.eql(await AdminService.read('Authors'))
|
||||||
.to.eql(await AdminService.run(SELECT.from(Authors)))
|
.to.eql(await AdminService.run(SELECT.from(Authors)))
|
||||||
// temporary workaround
|
// temporary workaround
|
||||||
if (AdminService.read.fix_50)
|
if (cds.version >= '4.2.0')
|
||||||
expect(await AdminService.run(SELECT.from(Authors))).to.eql(
|
_.to.eql(await AdminService.run(SELECT.from('Authors')))
|
||||||
await AdminService.run(SELECT.from('Authors'))
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('allows reading from local services using cds.ql', async () => {
|
it('allows reading from local services using cds.ql', async () => {
|
||||||
@@ -37,9 +35,8 @@ describe('Consuming Services locally', () => {
|
|||||||
})
|
})
|
||||||
}).where(`name like`, 'E%')
|
}).where(`name like`, 'E%')
|
||||||
// temporary workaround
|
// temporary workaround
|
||||||
if (!AdminService.read.fix_50) {
|
if (cds.version < '4.2.0')
|
||||||
query.SELECT.from.ref[0] = 'AdminService.Authors'
|
query.SELECT.from.ref[0] = 'AdminService.Authors'
|
||||||
}
|
|
||||||
const authors = await AdminService.run(query)
|
const authors = await AdminService.run(query)
|
||||||
expect(authors).to.containSubset([
|
expect(authors).to.containSubset([
|
||||||
{
|
{
|
||||||
@@ -77,17 +74,14 @@ describe('Consuming Services locally', () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
const query1 = SELECT.from(Authors, projection).where(`name like`, 'E%')
|
const query1 = SELECT.from(Authors, projection).where(`name like`, 'E%')
|
||||||
|
const query2 = cds.read(Authors, projection).where(`name like`, 'E%')
|
||||||
expect(await cds.run(query1))
|
expect(await cds.run(query1))
|
||||||
.to.eql(await db.run(query1))
|
.to.eql(await db.run(query1))
|
||||||
.to.eql(await srv.run(query1))
|
.to.eql(await srv.run(query1))
|
||||||
.to.eql(await srv.read(Authors, projection).where(`name like`, 'E%'))
|
.to.eql(await srv.read(Authors, projection).where(`name like`, 'E%'))
|
||||||
const query2 = cds.read(Authors, projection).where(`name like`, 'E%')
|
|
||||||
// temporary workaround
|
|
||||||
if (srv.read.fix_50)
|
|
||||||
expect(await cds.run(query1))
|
|
||||||
.to.eql(await cds.run(query2))
|
.to.eql(await cds.run(query2))
|
||||||
.to.eql(await db.run(query2))
|
.to.eql(await db.run(query2))
|
||||||
.to.eql(await srv.run(query2))
|
.to.eql(await srv.run(query2))
|
||||||
.to.eql(await db.read(Authors, projection).where(`name like`, 'E%')) // FIXME!!
|
.to.eql(await db.read(Authors, projection).where(`name like`, 'E%'))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ describe('Localized Data', () => {
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
xit('supports @cds.localized:false', async ()=>{
|
it('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`, {
|
const { data } = await GET(`/browse/BooksSans?&$select=title,localized_title&$expand=currency&$filter=locale eq 'de' or locale eq null`, {
|
||||||
headers: { 'Accept-Language': 'de' },
|
headers: { 'Accept-Language': 'de' },
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user