aboutsummaryrefslogtreecommitdiff
path: root/packages/bun-plugin-yaml/index.test.ts
blob: e8a41b8229a7f8186a944a72555ffb11329d296e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { test, expect } from "bun:test";
import YamlPlugin from ".";
import data from "./data.yml";

test("yaml loader - no plugin", async () => {
  expect(async () => {
    await import("./data.yml");
  }).toThrow();
});

test("yaml loader", async () => {
  const plugin = YamlPlugin();
  Bun.plugin(plugin);
  const { default: mod } = await import("./data.yml");

  expect(mod.doe).toEqual("a deer, a female deer");
  expect(mod.ray).toEqual("a drop of golden sun");
  expect(mod.pi).toEqual(3.14159);

  Bun.plugin.clearAll();
});