mirror of
https://github.com/denoland/std.git
synced 2024-11-22 04:59:05 +00:00
d13ef17a5d
This commit improves docs of the front-matter module. Specifically, the following things are done: - Use `@example` where appropriate to render the examples more beautifully - Split the big example attached to `createExtractor` function into smaller pieces so that each one has minimal yet meaningful example - Add `@returns` to the `test` function - Deduplicate `Format` type definition - Add a brief description to `Format` type Towards #3764 --------- Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
27 lines
703 B
TypeScript
27 lines
703 B
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
|
|
import { test } from "./test.ts";
|
|
import { extract } from "./json.ts";
|
|
import {
|
|
runExtractJsonTests,
|
|
runExtractTypeErrorTests,
|
|
runTestInvalidInputTests,
|
|
runTestValidInputTests,
|
|
} from "./_test_utils.ts";
|
|
|
|
Deno.test("test() handles valid input", () => {
|
|
runTestValidInputTests("json", test);
|
|
});
|
|
|
|
Deno.test("test() handles invalid input", () => {
|
|
runTestInvalidInputTests("json", test);
|
|
});
|
|
|
|
Deno.test("json() extracts type error on invalid input", () => {
|
|
runExtractTypeErrorTests("json", extract);
|
|
});
|
|
|
|
Deno.test("json() parses json delineate by ---json", async () => {
|
|
await runExtractJsonTests(extract);
|
|
});
|