-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathequal_test.ts
48 lines (43 loc) · 1.39 KB
/
equal_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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2023-latest the httpland authors. All rights reserved. MIT license.
import { equalsHeaders } from "./equal.ts";
import { assert, assertFalse, describe, it } from "./_dev_deps.ts";
describe("equalsHeaders", () => {
it("should return false", () => {
const table: [Headers, Headers][] = [
[new Headers({ a: "" }), new Headers()],
[new Headers(), new Headers({ a: "" })],
[new Headers({ a: "" }), new Headers({ a: "", b: "" })],
[new Headers({ a: "", b: "c" }), new Headers({ a: "", d: "c" })],
[new Headers({ a: "a" }), new Headers({ a: "b" })],
[
new Headers({ a: "b", b: "c" }),
new Headers({ a: "b", b: "c", c: "d" }),
],
];
table.forEach(([a, b]) => {
assertFalse(equalsHeaders(a, b));
});
});
it("should return true", () => {
const table: [Headers, Headers][] = [
[new Headers(), new Headers()],
[new Headers({ a: "" }), new Headers({ a: "" })],
[new Headers([["a", ""]]), new Headers({ a: "" })],
[
new Headers({ a: "", b: "c", c: "abc" }),
new Headers({ a: "", b: "c", c: "abc" }),
],
[
new Headers({ a: " " }),
new Headers({ a: "" }),
],
[
new Headers({ a: " a " }),
new Headers({ a: " a " }),
],
];
table.forEach(([a, b]) => {
assert(equalsHeaders(a, b));
});
});
});