Commit | Line | Data |
---|---|---|
329f14c0 | 1 | /* eslint-disable @typescript-eslint/no-unsafe-member-access */ |
2a9305b5 | 2 | import { expect } from 'expect' |
0749233f | 3 | import { describe, it } from 'node:test' |
2a9305b5 JB |
4 | |
5 | import { FileType } from '../../src/types/index.js' | |
8598b561 | 6 | import { handleFileException, logPrefix } from '../../src/utils/ConfigurationUtils.js' |
2a9305b5 JB |
7 | |
8 | await 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 | }) |