deno.land / std@0.224.0 / front_matter / test_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
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { assert, assertThrows } from "../assert/mod.ts";import { resolveTestDataPath, runTestInvalidInputTests, runTestValidInputTests,} from "./_test_utils.ts";import { test } from "./test.ts";
// GENERAL TESTS //
Deno.test("test() tests for unknown format", () => { assertThrows( () => test("foo", ["unknown"]), TypeError, "Unable to test for unknown front matter format", );});
// YAML //
Deno.test("test() handles valid yaml input", () => { runTestValidInputTests("yaml", test);});
Deno.test("test() handles invalid yaml input", () => { runTestInvalidInputTests("yaml", test);});
Deno.test({ name: "test() handles yaml text between horizontal rules", async fn() { const str = await Deno.readTextFile( resolveTestDataPath("./horizontal_rules.md"), );
assert(!test(str)); },});
// JSON //
Deno.test("test() handles valid json input", () => { runTestValidInputTests("json", test);});
Deno.test("test() handles invalid json input", () => { runTestInvalidInputTests("json", test);});
// TOML //
Deno.test("test() handles valid toml input", () => { runTestValidInputTests("toml", test);});
Deno.test("test() handles invalid toml input", () => { runTestInvalidInputTests("toml", test);});
std

Version Info

Tagged at
3 weeks ago