From 0cfbff4b525048f04cd3e8d45303d34d19007fcc Mon Sep 17 00:00:00 2001 From: "harshitha.d" Date: Thu, 11 Dec 2025 21:16:22 +0530 Subject: [PATCH] fix: update user-test to correctly handle invalid region errors --- test/sanity-check/api/user-test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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() } }) })