MCPcopy Create free account
hub / github.com/denoland/std / fn

Function fn

http/cookie_test.ts:14–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12Deno.test({
13 name: "getCookies() parses cookie",
14 fn() {
15 let headers = new Headers();
16 assertEquals(getCookies(headers), {});
17 headers = new Headers();
18 headers.set("Cookie", "foo=bar");
19 assertEquals(getCookies(headers), { foo: "bar" });
20
21 headers = new Headers();
22 headers.set("Cookie", "full=of ; tasty=chocolate");
23 assertEquals(getCookies(headers), { full: "of ", tasty: "chocolate" });
24
25 headers = new Headers();
26 headers.set("Cookie", "igot=99; problems=but...");
27 assertEquals(getCookies(headers), { igot: "99", problems: "but..." });
28
29 headers = new Headers();
30 headers.set("Cookie", "PREF=al=en-GB&f1=123; wide=1; SID=123");
31 assertEquals(getCookies(headers), {
32 PREF: "al=en-GB&f1=123",
33 wide: "1",
34 SID: "123",
35 });
36
37 headers = new Headers();
38 headers.set("Cookie", "=");
39 assertThrows(() => getCookies(headers));
40 },
41});
42
43Deno.test({

Callers

nothing calls this directly

Calls 12

assertEqualsFunction · 0.90
getCookiesFunction · 0.90
assertThrowsFunction · 0.90
assertTypeFunction · 0.90
setCookieFunction · 0.90
deleteCookieFunction · 0.90
assertFunction · 0.90
getSetCookiesFunction · 0.90
stubFunction · 0.90
forEachMethod · 0.80
setMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected