Skip to content

Commit 643ea84

Browse files
committed
fix(tests): Align generic error tests with SDK behavior
Corrects Jest tests for generic (non-API) error handling. The `error.status` is `undefined` in these scenarios, not `null`. Tests were updated from `expect(error.status).toBeNull()` to `expect(error.status).toBeUndefined()` to reflect this.
1 parent 01b842a commit 643ea84

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/KeyMintSDK.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ describe('KeyMintSDK', () => {
9393
} catch (error: any) {
9494
expect(error.message).toBe('Network connection failed');
9595
expect(error.code).toBe(-1); // Default code for generic errors
96-
expect(error.status).toBeNull(); // Status is null for non-HTTP errors
96+
expect(error.status).toBeUndefined(); // Status is undefined for non-HTTP errors
9797
}
9898
});
9999
});
@@ -152,7 +152,7 @@ describe('KeyMintSDK', () => {
152152
} catch (error: any) {
153153
expect(error.message).toBe('Connection timed out');
154154
expect(error.code).toBe(-1);
155-
expect(error.status).toBeNull();
155+
expect(error.status).toBeUndefined();
156156
}
157157
});
158158
});
@@ -207,7 +207,7 @@ describe('KeyMintSDK', () => {
207207
} catch (error: any) {
208208
expect(error.message).toBe('Server unreachable');
209209
expect(error.code).toBe(-1);
210-
expect(error.status).toBeNull();
210+
expect(error.status).toBeUndefined();
211211
}
212212
});
213213
});
@@ -281,7 +281,7 @@ describe('KeyMintSDK', () => {
281281
} catch (error: any) {
282282
expect(error.message).toBe('DNS resolution failed');
283283
expect(error.code).toBe(-1);
284-
expect(error.status).toBeNull();
284+
expect(error.status).toBeUndefined();
285285
}
286286
});
287287
});
@@ -335,7 +335,7 @@ describe('KeyMintSDK', () => {
335335
} catch (error: any) {
336336
expect(error.message).toBe('Request failed due to network issue');
337337
expect(error.code).toBe(-1);
338-
expect(error.status).toBeNull();
338+
expect(error.status).toBeUndefined();
339339
}
340340
});
341341
});
@@ -389,7 +389,7 @@ describe('KeyMintSDK', () => {
389389
} catch (error: any) {
390390
expect(error.message).toBe('API endpoint unreachable');
391391
expect(error.code).toBe(-1);
392-
expect(error.status).toBeNull();
392+
expect(error.status).toBeUndefined();
393393
}
394394
});
395395
});

0 commit comments

Comments
 (0)