fix: ensure no charging profile purpose TxProfile is loaded at startup
[e-mobility-charging-stations-simulator.git] / tests / utils / ConfigurationUtils.test.ts
CommitLineData
329f14c0 1/* eslint-disable @typescript-eslint/no-unsafe-member-access */
2a9305b5
JB
2import { describe, it } from 'node:test'
3
4import { expect } from 'expect'
5
6import { FileType } from '../../src/types/index.js'
8598b561 7import { handleFileException, logPrefix } from '../../src/utils/ConfigurationUtils.js'
2a9305b5
JB
8
9await describe('ConfigurationUtils test suite', async () => {
8598b561
JB
10 await it('Verify logPrefix()', () => {
11 expect(logPrefix()).toContain(' Simulator configuration |')
12 })
13
329f14c0
JB
14 await it('Verify handleFileException()', t => {
15 t.mock.method(console, 'error')
2a9305b5
JB
16 const error = new Error()
17 error.code = 'ENOENT'
18 expect(() => {
0acbf5e6 19 handleFileException('path/to/module.js', FileType.Authorization, error, 'log prefix |')
2a9305b5 20 }).toThrow(error)
329f14c0 21 expect(console.error.mock.calls.length).toBe(1)
2a9305b5
JB
22 })
23})