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