From 1c8a973b12d0f4b50c079507368899fbb5703da5 Mon Sep 17 00:00:00 2001 From: beefchimi Date: Fri, 22 Dec 2023 12:54:23 -0500 Subject: [PATCH] :test_tube: [Utilities] Test new arrayShallowEquals() --- src/tests/utilities.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/tests/utilities.test.ts b/src/tests/utilities.test.ts index fd209ed..8586323 100644 --- a/src/tests/utilities.test.ts +++ b/src/tests/utilities.test.ts @@ -1,6 +1,7 @@ import {describe, it, expect} from 'vitest'; import { arrayOfLength, + arrayShallowEquals, clamp, progressPercentage, msToSec, @@ -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', () => {