deno.land / x / simple_utility@v0.0.9 / test / fetch.test.ts

نووسراو ببینە
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
import {assertEquals, serve} from "../deps.test.ts";import {fetchExtend} from "../src/fetch.ts";
const sample = new Uint8Array([ 0x71, 0xD6, 0xFB, 0x3D, 0xF9, 0xD9, 0x41, 0x07, 0x38, 0x4D, 0xC9, 0x72, 0xE4, 0xA5, 0x63, 0x37, 0xD6, 0x8D, 0x12, 0x75, 0x08, 0x62, 0xA1, 0xB6, 0xAC, 0x3B, 0xEC, 0x12, 0x5A, 0xBF, 0x4F, 0x3B]);
Deno.test({ name: "Fetch: Get", async fn(){ const ac = new AbortController();
serve(() => new Response(sample), { hostname: "127.0.0.1", port: 62000, signal: ac.signal });
const result = await fetchExtend("http://127.0.0.1:62000", "byte");
assertEquals(result, sample);
ac.abort(); }});
simple_utility

Version Info

Tagged at
a year ago