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 () => {
|
||||
const AdminService = await cds.connect.to('AdminService')
|
||||
const { Authors } = AdminService.entities
|
||||
expect(await AdminService.read(Authors))
|
||||
.to.eql(await AdminService.read('Authors'))
|
||||
.to.eql(await AdminService.run(SELECT.from(Authors)))
|
||||
const _ = expect (await AdminService.read(Authors))
|
||||
.to.eql(await AdminService.read('Authors'))
|
||||
.to.eql(await AdminService.run(SELECT.from(Authors)))
|
||||
// temporary workaround
|
||||
if (AdminService.read.fix_50)
|
||||
expect(await AdminService.run(SELECT.from(Authors))).to.eql(
|
||||
await AdminService.run(SELECT.from('Authors'))
|
||||
)
|
||||
if (cds.version >= '4.2.0')
|
||||
_.to.eql(await AdminService.run(SELECT.from('Authors')))
|
||||
})
|
||||
|
||||
it('allows reading from local services using cds.ql', async () => {
|
||||
@@ -37,9 +35,8 @@ describe('Consuming Services locally', () => {
|
||||
})
|
||||
}).where(`name like`, 'E%')
|
||||
// temporary workaround
|
||||
if (!AdminService.read.fix_50) {
|
||||
if (cds.version < '4.2.0')
|
||||
query.SELECT.from.ref[0] = 'AdminService.Authors'
|
||||
}
|
||||
const authors = await AdminService.run(query)
|
||||
expect(authors).to.containSubset([
|
||||
{
|
||||
@@ -77,17 +74,14 @@ describe('Consuming Services locally', () => {
|
||||
})
|
||||
}
|
||||
const query1 = SELECT.from(Authors, projection).where(`name like`, 'E%')
|
||||
expect(await cds.run(query1))
|
||||
.to.eql(await db.run(query1))
|
||||
.to.eql(await srv.run(query1))
|
||||
.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 db.run(query2))
|
||||
.to.eql(await srv.run(query2))
|
||||
.to.eql(await db.read(Authors, projection).where(`name like`, 'E%')) // FIXME!!
|
||||
expect(await cds.run(query1))
|
||||
.to.eql(await db.run(query1))
|
||||
.to.eql(await srv.run(query1))
|
||||
.to.eql(await srv.read(Authors, projection).where(`name like`, 'E%'))
|
||||
.to.eql(await cds.run(query2))
|
||||
.to.eql(await db.run(query2))
|
||||
.to.eql(await srv.run(query2))
|
||||
.to.eql(await db.read(Authors, projection).where(`name like`, 'E%'))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user