X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Futils%2FConfigurationUtils.test.ts;h=b0689b888a6f3ecc452275cb00242af680ae59ff;hb=3edfdf53dc3c75bf26b4737bb014e6e98239ef38;hp=e8bcf8e2b1fd057e0029ee324eae5523bf2d8651;hpb=2a9305b5ace7b5a49b5862c4282c1a88e3087da5;p=e-mobility-charging-stations-simulator.git diff --git a/tests/utils/ConfigurationUtils.test.ts b/tests/utils/ConfigurationUtils.test.ts index e8bcf8e2..b0689b88 100644 --- a/tests/utils/ConfigurationUtils.test.ts +++ b/tests/utils/ConfigurationUtils.test.ts @@ -1,16 +1,23 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { describe, it } from 'node:test' import { expect } from 'expect' import { FileType } from '../../src/types/index.js' -import { handleFileException } from '../../src/utils/ConfigurationUtils.js' +import { handleFileException, logPrefix } from '../../src/utils/ConfigurationUtils.js' await describe('ConfigurationUtils test suite', async () => { - await it('Verify handleFileException()', () => { + await it('Verify logPrefix()', () => { + expect(logPrefix()).toContain(' Simulator configuration |') + }) + + await it('Verify handleFileException()', t => { + t.mock.method(console, 'error') const error = new Error() error.code = 'ENOENT' expect(() => { - handleFileException('path/to/module.js', FileType.Authorization, error, 'log prefix') + handleFileException('path/to/module.js', FileType.Authorization, error, 'log prefix |') }).toThrow(error) + expect(console.error.mock.calls.length).toBe(1) }) })