Files
plainleaf/common/settings.test.ts
T
MaksandGitHub 8a3782e946 improve dependency management (#770)
* use import_map.json instead of per-file import

* remove test_deps.ts in favor of import_map

* remove common/deps.ts in favor of import_map

* use import_map instead of server/deps.ts

* make all plug-api files usable without an import_map

* make all lib files usable without an import_map

* remove web/deps.ts in favor of import_map

* fix plug build

* remove plug-api/deps.ts in favor of lib/deps.ts

* fix server deps bundled in client deps
2024-03-16 15:29:24 +01:00

62 lines
930 B
TypeScript

import { assertEquals } from "$std/testing/asserts.ts";
import { parseYamlSettings } from "./settings.ts";
Deno.test("Settings regex", () => {
const exampleSettings = {
foo: "bar",
żółć: "🟡", // make sure Unicode works
};
assertEquals(
parseYamlSettings(`
The typical case would be like this
\`\`\`yaml
foo: bar
żółć: 🟡
\`\`\`
`),
exampleSettings,
);
assertEquals(
parseYamlSettings(`
Tilde delimiters or yml should also work
~~~yml
foo: bar
żółć: 🟡
~~~
`),
exampleSettings,
);
assertEquals(
parseYamlSettings(`
\`\`\`yaml-settings
wrong info string
\`\`\`
~~~yaml
missing an end
~~
`),
{},
);
assertEquals(
parseYamlSettings(`
The little known feature of longer delimiters
\`\`\`\`\`yaml
complexText: |
\`\`\`yaml
~~~
\`\`\`\`
foo: bar
żółć: 🟡
\`\`\`\`\`
`),
{ ...exampleSettings, complexText: "```yaml\n~~~\n````\n" },
);
});