Skip to content

Commit

Permalink
🧪 [Utilities] Test new arrayShallowEquals()
Browse files Browse the repository at this point in the history
  • Loading branch information
beefchimi committed Dec 22, 2023
1 parent 5f90b01 commit 1c8a973
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/tests/utilities.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {describe, it, expect} from 'vitest';
import {
arrayOfLength,
arrayShallowEquals,
clamp,
progressPercentage,
msToSec,
Expand All @@ -23,6 +24,21 @@ describe('Utilities', () => {
expect(result).toHaveLength(mockLength);
});
});

describe('arrayShallowEquals()', () => {
it('returns `true` when matching', () => {
const result = arrayShallowEquals(
[true, false, null, undefined, 0, 1, 'end'],
[true, false, null, undefined, 0, 1, 'end'],
);
expect(result).toBe(true);
});

it('returns `false` when at least one value is unmatched', () => {
const result = arrayShallowEquals([true, false], [false, true]);
expect(result).toBe(false);
});
});
});

describe('Numbers', () => {
Expand Down

0 comments on commit 1c8a973

Please sign in to comment.