-
-
Notifications
You must be signed in to change notification settings - Fork 530
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add unit tests for "InternalError"
- Loading branch information
1 parent
826fb09
commit 6ca4cad
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { InternalError } from './devUtils' | ||
|
||
describe(InternalError, () => { | ||
it('creates an InternalError instance', () => { | ||
const error = new InternalError('Message') | ||
|
||
expect(error.name).toBe('InternalError') | ||
expect(error.message).toBe('Message') | ||
expect(error.toString()).toBe('InternalError: Message') | ||
expect(error.stack).toMatch(/\w+/) | ||
}) | ||
|
||
it('passes the identity check', () => { | ||
const error = new InternalError('Message') | ||
expect(error instanceof InternalError).toBe(true) | ||
expect(error instanceof Error).toBe(true) | ||
|
||
const extraneousError = new Error('Message') | ||
expect(extraneousError).not.toBeInstanceOf(InternalError) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters