Skip to main content
Module

x/y2j/mod_test.ts

πŸ”„ YAML to JSON and vice versa
Latest
File
import { assertEquals } from "https://deno.land/std@0.134.0/testing/asserts.ts";
import { JSONtoYAML, YAMLtoJSON } from "./mod.ts";
const exampleJSON = `{ "name": "John", "age": 30, "cars": [ "Ford", "BMW", "Fiat" ]}`;
const exampleYAML = `name: Johnage: 30cars: - Ford - BMW - Fiat`;
Deno.test("JSON to YAML", () => { assertEquals(JSONtoYAML(exampleJSON), exampleYAML);});
Deno.test("YAML to JSON", () => { assertEquals(YAMLtoJSON(exampleYAML), exampleJSON);});