From 329f14c004f74241c7cae1400e81740f3333eeee Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 7 Jun 2024 16:24:59 +0200 Subject: [PATCH] test: improve ConfigurationUtils coverage MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- tests/utils/ConfigurationUtils.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) }) }) -- 2.34.1