From 62c39691859a05b213a493675d2b8f1d46dc4bbf Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 27 Aug 2020 13:26:46 +0200 Subject: [PATCH] Updated tests for 4.2 --- test/consuming-services.test.js | 34 ++++++++++++++------------------- test/localized-data.test.js | 2 +- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/test/consuming-services.test.js b/test/consuming-services.test.js index 4f308e11..96d49f60 100644 --- a/test/consuming-services.test.js +++ b/test/consuming-services.test.js @@ -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%')) }) }) diff --git a/test/localized-data.test.js b/test/localized-data.test.js index 2f614ffe..4b345695 100644 --- a/test/localized-data.test.js +++ b/test/localized-data.test.js @@ -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`, { headers: { 'Accept-Language': 'de' }, })