Skip to content

Commit d8f26b4

Browse files
committed
fix: resolve Anthropic provider test failure with lazy-loaded error classes
Changed assertRejects function to compare error class names instead of instanceof to handle lazy-loaded error classes that aren't recognized as same instance.
1 parent c198171 commit d8f26b4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/anthropic.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async function assertRejects(promise: Promise<any>, errorType?: any, message?: s
6262
await promise;
6363
throw new Error(`❌ Expected promise to reject${message ? `: ${message}` : ''}`);
6464
} catch (error) {
65-
if (errorType && !(error instanceof errorType)) {
65+
if (errorType && error.constructor.name !== errorType.name) {
6666
throw new Error(
6767
`❌ Expected error of type ${errorType.name}, got ${error.constructor.name}${message ? `: ${message}` : ''}`
6868
);

0 commit comments

Comments
 (0)