@@ -174,12 +174,12 @@ describe("generateTS function with errors", () => {
174174 } ) ;
175175
176176 it ( "Check for Invalid region" , async ( ) => {
177- const token = "your-token" ;
178- const apiKey = "your-api-key" ;
179- const environment = "development" ;
180- const region = "demo " as unknown as any ;
181- const tokenType = "delivery" ;
182- const branch = "main" ;
177+ const token = process . env . TOKEN as unknown as any ;
178+ const apiKey = process . env . APIKEY as unknown as any ;
179+ const environment = process . env . ENVIRONMENT as unknown as any ;
180+ const region = "wrong " as unknown as any ;
181+ const tokenType = process . env . TOKENTYPE as unknown as any ;
182+ const branch = process . env . BRANCH as unknown as any ;
183183
184184 try {
185185 await generateTS ( {
@@ -191,7 +191,9 @@ describe("generateTS function with errors", () => {
191191 branch,
192192 } ) ;
193193 } catch ( err : any ) {
194- expect ( err . error_message ) . toEqual ( "Something went wrong" ) ;
194+ expect ( err . error_message ) . toEqual (
195+ "Something went wrong while initializing Contentstack SDK."
196+ ) ;
195197 }
196198 } ) ;
197199
@@ -230,7 +232,9 @@ describe("generateTS function with errors", () => {
230232 const tokenType = "delivery" ;
231233 const branch = "main" ;
232234
233- mockClient . onGet ( `/content_types` ) . reply ( 401 ) ;
235+ mockClient . onGet ( `/content_types` ) . reply ( 401 , {
236+ status : 401 ,
237+ } ) ;
234238
235239 try {
236240 await generateTS ( {
@@ -256,7 +260,9 @@ describe("generateTS function with errors", () => {
256260 const tokenType = "delivery" ;
257261 const branch = "main" ;
258262
259- mockClient . onGet ( `/content_types` ) . reply ( 401 ) ;
263+ mockClient . onGet ( `/content_types` ) . reply ( 401 , {
264+ status : 401 ,
265+ } ) ;
260266
261267 try {
262268 await generateTS ( {
@@ -342,7 +348,9 @@ describe("generateTS function with errors", () => {
342348
343349 mockClient . onGet ( `/content_types` ) . reply ( 200 , contentTypes ) ;
344350
345- mockClient . onGet ( `/global_fields` ) . reply ( 401 ) ;
351+ mockClient . onGet ( `/global_fields` ) . reply ( 401 , {
352+ status : 401 ,
353+ } ) ;
346354
347355 try {
348356 await generateTS ( {
0 commit comments