From f32398ba8dd9b10c7f236282c3e1f89067e64c6f Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 7 Dec 2020 12:39:33 +0100 Subject: [PATCH] Using cds.User.default in 4.4.4 --- test/custom-handlers.test.js | 4 +++- test/localized-data.test.js | 4 +++- test/odata.test.js | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/test/custom-handlers.test.js b/test/custom-handlers.test.js index c27779ae..f8541a18 100644 --- a/test/custom-handlers.test.js +++ b/test/custom-handlers.test.js @@ -1,5 +1,7 @@ const { GET, POST, expect } = require('../test') .run ('bookshop') -const cds = require('@sap/cds/lib'); cds.User = cds.User.Privileged // skip auth +const cds = require('@sap/cds/lib') +if (cds.User.default) cds.User.default = cds.User.Privileged // hard core monkey patch +else cds.User = cds.User.Privileged // hard core monkey patch for older cds releases describe('Custom Handlers', () => { diff --git a/test/localized-data.test.js b/test/localized-data.test.js index 9c840830..bfa3411f 100644 --- a/test/localized-data.test.js +++ b/test/localized-data.test.js @@ -1,5 +1,7 @@ const { GET, expect } = require('../test') .run ('serve', 'test/localized-data.cds', '--in-memory') -const cds = require('@sap/cds/lib'); cds.User = cds.User.Privileged // skip auth +const cds = require('@sap/cds/lib') +if (cds.User.default) cds.User.default = cds.User.Privileged // hard core monkey patch +else cds.User = cds.User.Privileged // hard core monkey patch for older cds releases describe('Localized Data', () => { diff --git a/test/odata.test.js b/test/odata.test.js index 25a8c604..7d8c8123 100644 --- a/test/odata.test.js +++ b/test/odata.test.js @@ -1,5 +1,7 @@ const { GET, expect } = require('../test') .run ('bookshop') -const cds = require('@sap/cds/lib'); cds.User = cds.User.Privileged // skip auth +const cds = require('@sap/cds/lib') +if (cds.User.default) cds.User.default = cds.User.Privileged // hard core monkey patch +else cds.User = cds.User.Privileged // hard core monkey patch for older cds releases describe('OData Protocol', () => {