-
Notifications
You must be signed in to change notification settings - Fork 574
/
any_test.ts
71 lines (54 loc) · 1.76 KB
/
any_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
62
63
64
65
66
67
68
69
70
71
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { test } from "./test.ts";
import { extract } from "./any.ts";
import {
runExtractJSONTests,
runExtractTOMLTests,
runExtractTypeErrorTests,
runExtractYAMLTests1,
runExtractYAMLTests2,
runTestInvalidInputTests,
runTestValidInputTests,
} from "./_test_utils.ts";
// YAML //
Deno.test("test() handles valid input", () => {
runTestValidInputTests("yaml", test);
});
Deno.test("test() handles invalid input", () => {
runTestInvalidInputTests("yaml", test);
});
Deno.test("extract() extracts type error on invalid input", () => {
runExtractTypeErrorTests("yaml", extract);
});
Deno.test("extract() parses yaml delineate by `---`", async () => {
await runExtractYAMLTests1(extract);
});
Deno.test("extract() parses yaml delineate by `---yaml`", async () => {
await runExtractYAMLTests2(extract);
});
// JSON //
Deno.test("test() handles valid json input", () => {
runTestValidInputTests("json", test);
});
Deno.test("test() handles invalid json input", () => {
runTestInvalidInputTests("json", test);
});
Deno.test("extract() extracts type error on invalid json input", () => {
runExtractTypeErrorTests("json", extract);
});
Deno.test("extract() parses json delineate by ---json", async () => {
await runExtractJSONTests(extract);
});
// TOML //
Deno.test("test() test valid input true", () => {
runTestValidInputTests("toml", test);
});
Deno.test("test() handles invalid toml input false", () => {
runTestInvalidInputTests("toml", test);
});
Deno.test("extract() extracts type error on invalid toml input", () => {
runExtractTypeErrorTests("toml", extract);
});
Deno.test("extract() parses toml delineate by ---toml", async () => {
await runExtractTOMLTests(extract);
});