Nessuna descrizione

BaseError.test.ts 864B

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