docs(README.md): refine volta installation on windows
[e-mobility-charging-stations-simulator.git] / tests / utils / ConfigurationUtils.test.ts
index f613ac8f4f05f2282463cc9b3c3b271c74c5cf2e..b0689b888a6f3ecc452275cb00242af680ae59ff 100644 (file)
@@ -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)
   })
 })