deno.land / x / lume@v2.1.4 / tests / core / formats.test.ts

formats.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
import { assert, assertStrictEquals as equals } from "../../deps/assert.ts";import Formats from "../../core/formats.ts";
Deno.test("Formats", async (t) => { const formats = new Formats();
equals(formats.entries.size, 0); equals(formats.size, 0);
await t.step("Add extensions", () => { formats.set({ ext: ".foo", copy: true }); equals(formats.entries.size, 1); equals(formats.size, 1); equals(formats.get(".foo")?.ext, ".foo"); equals(formats.get(".foo")?.copy, true); assert(formats.has(".foo"));
formats.set({ ext: ".foo", copy: false }); equals(formats.entries.size, 1); equals(formats.size, 1); equals(formats.get(".foo")?.ext, ".foo"); equals(formats.get(".foo")?.copy, false); assert(formats.has(".foo")); });
await t.step("Add subextensions", () => { formats.set({ ext: ".sub.foo", copy: true }); equals(formats.entries.size, 2); equals(formats.size, 2); equals(formats.get(".foo")?.copy, false); equals(formats.get(".sub.foo")?.copy, true); assert(formats.has(".sub.foo")); });
await t.step("Search extensions", () => { const format = formats.search("name.foo"); assert(format); equals(format.ext, ".foo"); });
await t.step("Search subextensions", () => { const format = formats.search("name.sub.foo"); assert(format); equals(format.ext, ".sub.foo"); });});
lume

Version Info

Tagged at
7 months ago