Files
cannaiq/backend/node_modules/web-encoding/test/test-lib.spec.mjs
2025-11-28 19:45:44 -07:00

29 lines
524 B
JavaScript

import { TextEncoder, TextDecoder } from "../src/lib.js"
import assert from "assert"
describe("text encode/decode", () => {
const data = Uint8Array.from([
104,
101,
108,
108,
111,
32,
119,
111,
114,
108,
100,
])
it("can encode text", () => {
const bytes = new TextEncoder().encode("hello world")
assert.deepStrictEqual(bytes, data)
})
it("can decode text", () => {
const text = new TextDecoder().decode(data)
assert.equal(text, "hello world")
})
})