Skip to content

Commit 97343d3

Browse files
Merge pull request #471 from contentstack/fix/endpoint-test-case
fix: update user-test to correctly handle invalid region errors
2 parents 1f08084 + 0cfbff4 commit 97343d3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/sanity-check/api/user-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@ describe('Contentstack User Session api Test', () => {
136136
// The new implementation uses getContentstackEndpoint which handles region validation
137137
// It should not throw an error, but will use whatever getContentstackEndpoint returns
138138
try {
139-
const client = contentstack.client({ region: 'DUMMYREGION' })
140-
expect(client).to.not.equal(null, 'Client should be created even with invalid region')
141-
done()
139+
contentstack.client({ region: 'DUMMYREGION' })
140+
done(new Error('Expected an error to be thrown for invalid region'))
142141
} catch (error) {
143-
done(error)
142+
expect(error.message).to.include('Invalid region')
143+
done()
144144
}
145145
})
146146
})

0 commit comments

Comments
 (0)