Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
vladbasin committed Nov 12, 2024
1 parent 485b115 commit 66be24d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/Result.withProcessedFailError.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,15 @@ describe('Result', () => {
try {
await result;
} catch (error) {
expect(error).toBeInstanceOf(ProcessedError);
expect(error.message).toBe('Processed error');
expect(error.stack).toBeDefined();
expect(error.stack).toContain('Initial error');
expect(error.stack).toContain('ProcessedError');
if (error instanceof ProcessedError) {
expect(error).toBeInstanceOf(ProcessedError);
expect(error.message).toBe('Processed error');
expect(error.stack).toBeDefined();
expect(error.stack).toContain('Initial error');
expect(error.stack).toContain('ProcessedError');
} else {
throw new Error('Expected ProcessedError');
}
}

Error.captureStackTrace = originalCaptureStackTrace;
Expand Down

0 comments on commit 66be24d

Please sign in to comment.