~bmp/hayom

ref: 256b9e7d6010bf030c6fb71d731c2947eb95a4e1 hayom/test.ts -rw-r--r-- 1.2 KiB
256b9e7dBenjamin Pollack upgrade deps and lockfile 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { assertEquals } from "https://deno.land/std@0.118.0/testing/asserts.ts";

import { makeEntry } from "./mod.ts";

Deno.test("make sure we can generate simple entries", () => {
  const raw = "This is a simple test";
  const entry = makeEntry(raw);
  assertEquals(entry.title, "This is a simple test");
  assertEquals(entry.body, "");
});

Deno.test("make sure we can generate entries with a period", () => {
  const raw = "This is a simple test.";
  const entry = makeEntry(raw);
  assertEquals(entry.title, "This is a simple test.");
  assertEquals(entry.body, "");
});

Deno.test("make sure we can generate complex entries", () => {
  const raw = "This is a simple test!  How can you not understand that?!";
  const entry = makeEntry(raw);
  assertEquals(entry.title, "This is a simple test!");
  assertEquals(entry.body, "How can you not understand that?!");
});

Deno.test("test multiline entries", () => {
  const raw =
    "This is a simple test?!  I guess so.\nBut how can you be sure?  What should we\nbe doing?!";
  const entry = makeEntry(raw);
  assertEquals(entry.title, "This is a simple test?!");
  assertEquals(
    entry.body,
    "I guess so.\nBut how can you be sure?  What should we\nbe doing?!",
  );
});