Skip to content

Commit

Permalink
chore: add Array tests
Browse files Browse the repository at this point in the history
Signed-off-by: Okiki <okikio.dev@gmail.com>
  • Loading branch information
okikio committed Mar 3, 2024
1 parent 20d602d commit f423425
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/mod_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { assertEquals } from "https://deno.land/std@0.208.0/testing/asserts.ts";
import { asCodePointsIterator, asCodePointsCallback } from "../mod.ts";
import { assertEquals } from "https://deno.land/std/assert/assert_equals.ts";
import { asCodePointsArray, asCodePointsIterator, asCodePointsCallback } from "../mod.ts";

Deno.test("asCodePoints Array - converts utf-8 filled Uint8Array's into code points", async () => {
const iterable = (async function* () {
yield new Uint8Array([0x61, 0xC3, 0xA9, 0xE0, 0xA4, 0xB9, 0xF0, 0x9F, 0x98, 0x82]);
})();

const result: number[] = await asCodePointsArray(iterable);

assertEquals(result, [0x61, 0xE9, 0x939, 0x1F602]);
});

Deno.test("asCodePoints Iterator - converts utf-8 filled Uint8Array's into code points", async () => {
const iterable = (async function* () {
Expand All @@ -14,7 +24,6 @@ Deno.test("asCodePoints Iterator - converts utf-8 filled Uint8Array's into code
assertEquals(result, [0x61, 0xE9, 0x939, 0x1F602]);
});


Deno.test("asCodePoints Callback - converts utf-8 filled Uint8Array's into code points", async () => {
const iterable = (async function* () {
yield new Uint8Array([0x61, 0xC3, 0xA9, 0xE0, 0xA4, 0xB9, 0xF0, 0x9F, 0x98, 0x82]);
Expand Down

0 comments on commit f423425

Please sign in to comment.