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