X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Futils%2FConfigurationUtils.test.ts;h=b0689b888a6f3ecc452275cb00242af680ae59ff;hb=HEAD;hp=f613ac8f4f05f2282463cc9b3c3b271c74c5cf2e;hpb=0acbf5e6ab020dda7ddc6785347c05c144de3bd9;p=e-mobility-charging-stations-simulator.git diff --git a/tests/utils/ConfigurationUtils.test.ts b/tests/utils/ConfigurationUtils.test.ts index f613ac8f..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 |') }).toThrow(error) + expect(console.error.mock.calls.length).toBe(1) }) })