Commit | Line | Data |
---|---|---|
fba0276c JB |
1 | import { describe, it } from 'node:test' |
2 | ||
3 | import { expect } from 'expect' | |
4 | ||
5 | import { BaseError } from '../../src/exception/BaseError.js' | |
6 | ||
7 | await describe('BaseError test suite', async () => { | |
8 | await it('Verify that BaseError can be instantiated', () => { | |
9 | const baseError = new BaseError() | |
10 | expect(baseError).toBeInstanceOf(BaseError) | |
11 | expect(baseError.name).toBe('BaseError') | |
12 | expect(baseError.message).toBe('') | |
13 | expect(typeof baseError.stack === 'string').toBe(true) | |
14 | expect(baseError.stack).not.toBe('') | |
15 | expect(baseError.cause).toBeUndefined() | |
16 | expect(baseError.date).toBeInstanceOf(Date) | |
17 | }) | |
18 | ||
19 | await it('Verify that BaseError can be instantiated with a message', () => { | |
20 | const baseError = new BaseError('Test message') | |
21 | expect(baseError).toBeInstanceOf(BaseError) | |
22 | expect(baseError.message).toBe('Test message') | |
23 | }) | |
24 | }) |