UNPKG

zeuge

Version:

zeuge creates permanence for the content behind web2 URIs

23 lines (18 loc) 750 B
import test from "ava"; import { download, hash, identify } from "./index.mjs"; test("if download returns an array buffer", async t => { const url = "https://bitcoin.org/bitcoin.pdf"; const buf = await download(url); t.true(buf instanceof ArrayBuffer); }); test("if hash can be generated from array buffer", async t => { const url = "https://bitcoin.org/bitcoin.pdf"; const buf = await download(url); const digest = hash(buf); t.is(digest, "9a3ca9de6a5af14df0d06fd735eb6a0de9206b5be883cf891b1b1aaa84307627"); }); test("if id can be generated", async t => { const url = "https://bitcoin.org/bitcoin.pdf"; const digest = await identify(url); t.is(digest, "9a3ca9de6a5af14df0d06fd735eb6a0de9206b5be883cf891b1b1aaa84307627"); });