-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilter_values_test.ts
More file actions
31 lines (28 loc) · 1003 Bytes
/
filter_values_test.ts
File metadata and controls
31 lines (28 loc) · 1003 Bytes
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
// Copyright 2023-latest the httpland authors. All rights reserved. MIT license.
import { filterHeadersValues } from "./filter_values.ts";
import { equalsHeaders } from "./equal.ts";
import { assert, describe, it } from "./_dev_deps.ts";
describe("filterHeadersValues", () => {
it("should return new headers filtered by predicate", () => {
const table: [Headers, (value: string) => boolean, Headers][] = [
[
new Headers({ "x-test": "test", "date": "xxx" }),
() => true,
new Headers({ "x-test": "test", "date": "xxx" }),
],
[
new Headers({ "x-test": "test", "date": "xxx" }),
() => false,
new Headers(),
],
[
new Headers({ "x-test": "test", "date": "xxx" }),
(value) => value === "test",
new Headers({ "x-test": "test" }),
],
];
table.forEach(([headers, predicate, expected]) => {
assert(equalsHeaders(filterHeadersValues(headers, predicate), expected));
});
});
});