std/front_matter/toml_test.ts
Yusuke Tanaka d13ef17a5d
docs(front-matter): improve docs for stabilization (#4789)
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>
2024-05-27 18:14:52 -07:00

32 lines
841 B
TypeScript

// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { test } from "./test.ts";
import { extract } from "./toml.ts";
import {
runExtractTomlTests,
runExtractTomlTests2,
runExtractTypeErrorTests,
runTestInvalidInputTests,
runTestValidInputTests,
} from "./_test_utils.ts";
Deno.test("toml() tests valid input true", () => {
runTestValidInputTests("toml", test);
});
Deno.test("toml() tests invalid input false", () => {
runTestInvalidInputTests("toml", test);
});
Deno.test("toml() extracts type error on invalid input", () => {
runExtractTypeErrorTests("toml", extract);
});
Deno.test("toml() parses toml delineate by ---toml", async () => {
await runExtractTomlTests(extract);
});
Deno.test("toml() parses toml delineate by +++", async () => {
await runExtractTomlTests2(extract);
});