test: add ConfigurationUtils test
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 7 Jun 2024 11:36:22 +0000 (13:36 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 7 Jun 2024 11:36:22 +0000 (13:36 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
tests/utils/ConfigurationUtils.test.ts [new file with mode: 0644]

diff --git a/tests/utils/ConfigurationUtils.test.ts b/tests/utils/ConfigurationUtils.test.ts
new file mode 100644 (file)
index 0000000..e8bcf8e
--- /dev/null
@@ -0,0 +1,16 @@
+import { describe, it } from 'node:test'
+
+import { expect } from 'expect'
+
+import { FileType } from '../../src/types/index.js'
+import { handleFileException } from '../../src/utils/ConfigurationUtils.js'
+
+await describe('ConfigurationUtils test suite', async () => {
+  await it('Verify handleFileException()', () => {
+    const error = new Error()
+    error.code = 'ENOENT'
+    expect(() => {
+      handleFileException('path/to/module.js', FileType.Authorization, error, 'log prefix')
+    }).toThrow(error)
+  })
+})