test: switch to node.js test runner
[e-mobility-charging-stations-simulator.git] / test / utils / CircularArray.test.ts
index 34839dcb7b90b0dafe2c6837ebd092cdfb3858b7..90404f87c7541844767923ed5cf7e9d1fb7baa09 100644 (file)
@@ -1,24 +1,26 @@
+import { describe, it } from 'node:test';
+
 import { expect } from 'expect';
 
 import { CircularArray, DEFAULT_CIRCULAR_ARRAY_SIZE } from '../../src/utils/CircularArray';
 
-describe('CircularArray test suite', () => {
-  it('Verify that circular array can be instantiated', () => {
+await describe('CircularArray test suite', async () => {
+  await it('Verify that circular array can be instantiated', () => {
     const circularArray = new CircularArray();
     expect(circularArray).toBeInstanceOf(CircularArray);
   });
 
-  it('Verify circular array default size at instance creation', () => {
+  await it('Verify circular array default size at instance creation', () => {
     const circularArray = new CircularArray();
     expect(circularArray.size).toBe(DEFAULT_CIRCULAR_ARRAY_SIZE);
   });
 
-  it('Verify that circular array size can be set at instance creation', () => {
+  await it('Verify that circular array size can be set at instance creation', () => {
     const circularArray = new CircularArray(1000);
     expect(circularArray.size).toBe(1000);
   });
 
-  it('Verify that circular array size and items can be set at instance creation', () => {
+  await it('Verify that circular array size and items can be set at instance creation', () => {
     let circularArray = new CircularArray(1000, 1, 2, 3, 4, 5);
     expect(circularArray.size).toBe(1000);
     expect(circularArray.length).toBe(5);
@@ -27,7 +29,7 @@ describe('CircularArray test suite', () => {
     expect(circularArray.length).toBe(4);
   });
 
-  it('Verify that circular array size is valid at instance creation', () => {
+  await it('Verify that circular array size is valid at instance creation', () => {
     expect(() => new CircularArray(0.25)).toThrowError(
       new TypeError('Invalid circular array size: 0.25 is not a safe integer'),
     );
@@ -41,17 +43,17 @@ describe('CircularArray test suite', () => {
     );
   });
 
-  it('Verify that circular array empty works as intended', () => {
+  await it('Verify that circular array empty works as intended', () => {
     const circularArray = new CircularArray();
     expect(circularArray.empty()).toBe(true);
   });
 
-  it('Verify that circular array full works as intended', () => {
+  await it('Verify that circular array full works as intended', () => {
     const circularArray = new CircularArray(5, 1, 2, 3, 4, 5);
     expect(circularArray.full()).toBe(true);
   });
 
-  it('Verify that circular array push works as intended', () => {
+  await it('Verify that circular array push works as intended', () => {
     let circularArray = new CircularArray(4);
     let arrayLength = circularArray.push(1, 2, 3, 4, 5);
     expect(arrayLength).toBe(circularArray.size);
@@ -69,7 +71,7 @@ describe('CircularArray test suite', () => {
     expect(circularArray).toStrictEqual(new CircularArray(100, 1, 2, 3, 4, 5));
   });
 
-  it('Verify that circular array splice works as intended', () => {
+  await it('Verify that circular array splice works as intended', () => {
     let circularArray = new CircularArray(1000, 1, 2, 3, 4, 5);
     let deletedItems = circularArray.splice(2);
     expect(deletedItems).toStrictEqual(new CircularArray(3, 3, 4, 5));
@@ -87,7 +89,7 @@ describe('CircularArray test suite', () => {
     expect(circularArray).toStrictEqual(new CircularArray(4, 2, 5, 6, 4));
   });
 
-  it('Verify that circular array concat works as intended', () => {
+  await it('Verify that circular array concat works as intended', () => {
     let circularArray = new CircularArray(5, 1, 2, 3, 4, 5);
     circularArray = circularArray.concat(6, 7);
     expect(circularArray.length).toBe(5);
@@ -98,7 +100,7 @@ describe('CircularArray test suite', () => {
     expect(circularArray).toStrictEqual(new CircularArray(1, 7));
   });
 
-  it('Verify that circular array unshift works as intended', () => {
+  await it('Verify that circular array unshift works as intended', () => {
     let circularArray = new CircularArray(5, 1, 2, 3, 4, 5);
     let arrayLength = circularArray.unshift(6, 7);
     expect(arrayLength).toBe(5);
@@ -111,7 +113,7 @@ describe('CircularArray test suite', () => {
     expect(circularArray).toStrictEqual(new CircularArray(1, 6));
   });
 
-  it('Verify that circular array resize works as intended', () => {
+  await it('Verify that circular array resize works as intended', () => {
     expect(() => new CircularArray().resize(0.25)).toThrowError(
       new TypeError('Invalid circular array size: 0.25 is not a safe integer'),
     );