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