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', () => {