diff --git a/lib/contentstack.js b/lib/contentstack.js index 85398c9f..9d377999 100644 --- a/lib/contentstack.js +++ b/lib/contentstack.js @@ -172,7 +172,7 @@ import { getContentstackEndpoint } from '@contentstack/utils' */ export function client (params = {}) { let defaultHostName = params.region - ? getContentstackEndpoint(params.region.toUpperCase(), 'management', true) + ? getContentstackEndpoint(params.region.toUpperCase(), 'contentManagement', true) : getContentstackEndpoint('NA', 'contentManagement', true) if (params.host) { diff --git a/test/sanity-check/api/user-test.js b/test/sanity-check/api/user-test.js index 080b8f09..65806d84 100644 --- a/test/sanity-check/api/user-test.js +++ b/test/sanity-check/api/user-test.js @@ -136,11 +136,11 @@ describe('Contentstack User Session api Test', () => { // The new implementation uses getContentstackEndpoint which handles region validation // It should not throw an error, but will use whatever getContentstackEndpoint returns try { - const client = contentstack.client({ region: 'DUMMYREGION' }) - expect(client).to.not.equal(null, 'Client should be created even with invalid region') - done() + contentstack.client({ region: 'DUMMYREGION' }) + done(new Error('Expected an error to be thrown for invalid region')) } catch (error) { - done(error) + expect(error.message).to.include('Invalid region') + done() } }) })