Initial Commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { describe, expect, it } from "@suaveplan/testing/runner";
|
||||
import * as cd from "../src/index.js";
|
||||
|
||||
describe("@suaveplan/network-plugin-content-delivery public surface", () => {
|
||||
it("exports every documented class", () => {
|
||||
expect(cd.ChunkIndex).toBeDefined();
|
||||
expect(cd.ChunkRequestRouter).toBeDefined();
|
||||
expect(cd.RedundancyManager).toBeDefined();
|
||||
expect(cd.IntegrityVerifier).toBeDefined();
|
||||
expect(cd.ContentDeliveryPlugin).toBeDefined();
|
||||
});
|
||||
|
||||
it("exports the error registry", () => {
|
||||
expect(cd.NETWORK_CD_CODES).toBeDefined();
|
||||
expect(cd.NetworkCdError).toBeDefined();
|
||||
});
|
||||
|
||||
it("exports helper values", () => {
|
||||
expect(cd.DEFAULT_REDUNDANCY).toBeDefined();
|
||||
expect(typeof cd.defaultEncode).toBe("function");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
import { webcrypto } from "node:crypto";
|
||||
|
||||
type WritableGlobal = { crypto?: Crypto };
|
||||
const g = globalThis as WritableGlobal;
|
||||
if (g.crypto === undefined) {
|
||||
g.crypto = webcrypto as unknown as Crypto;
|
||||
}
|
||||
Reference in New Issue
Block a user