frontend/test/array.test.ts
raw| 1 | import { test } from "uvu"; |
| 2 | import assert from "uvu/assert"; |
| 3 | |
| 4 | import { is_non_empty, move } from "../src/lib/array"; |
| 5 | |
| 6 | test("check array is non-empty", () => { |
| 7 | assert.not(is_non_empty([])); |
| 8 | assert.ok(is_non_empty([1])); |
| 9 | }); |
| 10 | |
| 11 | test("move array elements", () => { |
| 12 | const initital = [0, 1, 2, 3]; |
| 13 | const moved = move(initital, 1, 2); |
| 14 | assert.equal(moved, [0, 2, 1, 3]); |
| 15 | assert.equal(initital, [0, 1, 2, 3]); |
| 16 | }); |
| 17 | |
| 18 | test.run(); |