-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { arraysHaveSameValues } from "../../utils/array"; | ||
|
||
describe("arraysHaveSameValues", () => { | ||
it("should return true for arrays with the same values", () => { | ||
const arr1 = [1, 2, 3]; | ||
const arr2 = [3, 2, 1]; | ||
expect(arraysHaveSameValues(arr1, arr2)).toBe(true); | ||
}); | ||
|
||
it("should return false for arrays with different lengths", () => { | ||
const arr1 = [1, 2, 3]; | ||
const arr2 = [1, 2, 3, 4]; | ||
expect(arraysHaveSameValues(arr1, arr2)).toBe(false); | ||
}); | ||
|
||
it("should return false for arrays with different values", () => { | ||
const arr1 = [1, 2, 3]; | ||
const arr2 = [4, 5, 6]; | ||
expect(arraysHaveSameValues(arr1, arr2)).toBe(false); | ||
}); | ||
|
||
it("should return true for empty arrays", () => { | ||
const arr1: number[] = []; | ||
const arr2: number[] = []; | ||
expect(arraysHaveSameValues(arr1, arr2)).toBe(true); | ||
}); | ||
|
||
it("should return true for arrays with duplicate values", () => { | ||
const arr1 = [1, 2, 2, 3, 4]; | ||
const arr2 = [3, 2, 1, 4, 2]; | ||
expect(arraysHaveSameValues(arr1, arr2)).toBe(true); | ||
}); | ||
}); |