From: Jérôme Benoit Date: Fri, 7 Jun 2024 14:24:59 +0000 (+0200) Subject: test: improve ConfigurationUtils coverage X-Git-Tag: v1.3.5~15 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=329f14c004f74241c7cae1400e81740f3333eeee;p=e-mobility-charging-stations-simulator.git test: improve ConfigurationUtils coverage Signed-off-by: Jérôme Benoit --- diff --git a/tests/utils/ConfigurationUtils.test.ts b/tests/utils/ConfigurationUtils.test.ts index f613ac8f..a7eae639 100644 --- a/tests/utils/ConfigurationUtils.test.ts +++ b/tests/utils/ConfigurationUtils.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { describe, it } from 'node:test' import { expect } from 'expect' @@ -6,11 +7,13 @@ import { FileType } from '../../src/types/index.js' import { handleFileException } from '../../src/utils/ConfigurationUtils.js' await describe('ConfigurationUtils test suite', async () => { - await it('Verify handleFileException()', () => { + 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) }) })