deno.land / x / swarm_gates@0.0.1 / test.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import SwarmGates from "./mod.ts";import { testing,} from "./deps.js";
const text_data = "SwarmGates";const host = "https://swarm-gateways.net";
const gate = new SwarmGates(host);let hash;
Deno.test("Uploads raw data correctly", async () => { hash = await gate.upload(new TextEncoder().encode((text_data))); testing.assert(hash, "Hash for file wasn't retrieved correctly");
await testing.assertThrowsAsync(async () => { await gate.upload(new Uint8Array()); });});
Deno.test("Downloads raw data correctly", async () => { const data = await gate.download(hash);
testing.assertEquals(new TextDecoder().decode(data), text_data);});
Deno.test("Checks availability", async () => { const data = await gate.isAvailable();
testing.assert(data);});
swarm_gates

Version Info

Tagged at
3 years ago

External Dependencies

1 external dependency