test(yaml): add test for deprecated boolean syntax (#5713)

* initial commit

* Update yaml/stringify_test.ts

* Update yaml/stringify_test.ts

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
This commit is contained in:
Tim Reichen 2024-08-20 01:38:22 +02:00 committed by GitHub
parent 75cb7674f1
commit b929d05156
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -668,6 +668,13 @@ Deno.test("stringify() handles string", () => {
assertEquals(stringify("Hello World"), "Hello World\n");
});
Deno.test("stringify() uses quotes around deprecated boolean notations when `compatMode: true`", () => {
assertEquals(stringify("On", { compatMode: true }), "'On'\n");
assertEquals(stringify("Off", { compatMode: true }), "'Off'\n");
assertEquals(stringify("Yes", { compatMode: true }), "'Yes'\n");
assertEquals(stringify("No", { compatMode: true }), "'No'\n");
});
Deno.test("stringify() handles undefined with skipInvalid option", () => {
assertEquals(stringify(undefined, { skipInvalid: true }), "");
});