Commit | Line | Data |
---|---|---|
b49550e2 | 1 | import { expect } from 'expect' |
0749233f | 2 | import { describe, it } from 'node:test' |
b49550e2 JB |
3 | |
4 | import { OCPPError } from '../../src/exception/OCPPError.js' | |
5 | import { ErrorType } from '../../src/types/index.js' | |
6 | import { Constants } from '../../src/utils/Constants.js' | |
7 | ||
8 | await describe('OCPPError test suite', async () => { | |
9 | await it('Verify that OCPPError can be instantiated', () => { | |
10 | const ocppError = new OCPPError(ErrorType.GENERIC_ERROR, '') | |
11 | expect(ocppError).toBeInstanceOf(OCPPError) | |
12 | expect(ocppError.name).toBe('OCPPError') | |
13 | expect(ocppError.message).toBe('') | |
14 | expect(ocppError.code).toBe(ErrorType.GENERIC_ERROR) | |
15 | expect(ocppError.command).toBe(Constants.UNKNOWN_OCPP_COMMAND) | |
16 | expect(ocppError.details).toBeUndefined() | |
17 | expect(typeof ocppError.stack === 'string').toBe(true) | |
18 | expect(ocppError.stack).not.toBe('') | |
19 | expect(ocppError.cause).toBeUndefined() | |
20 | expect(ocppError.date).toBeInstanceOf(Date) | |
21 | }) | |
22 | }) |