Skip to content

Commit

Permalink
test(yaml): improve coverage for nil Type (#5525)
Browse files Browse the repository at this point in the history
tests(yaml): improve coverage for nil `Type`
  • Loading branch information
iuioiua authored Jul 23, 2024
1 parent d6dde6f commit 044fc27
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
3 changes: 0 additions & 3 deletions yaml/_type/nil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ export const nil: Type<"scalar", null> = {
kind: "scalar",
predicate: isNull,
represent: {
canonical(): string {
return "~";
},
lowercase(): string {
return "null";
},
Expand Down
16 changes: 16 additions & 0 deletions yaml/stringify_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,3 +504,19 @@ skills:
`,
);
});

Deno.test("stringify() handles nil", () => {
assertEquals(stringify(null), "null\n");
assertEquals(
stringify(null, { styles: { "tag:yaml.org,2002:null": "lowercase" } }),
"null\n",
);
assertEquals(
stringify(null, { styles: { "tag:yaml.org,2002:null": "uppercase" } }),
"NULL\n",
);
assertEquals(
stringify(null, { styles: { "tag:yaml.org,2002:null": "camelcase" } }),
"Null\n",
);
});

0 comments on commit 044fc27

Please sign in to comment.