summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/generateApi.spec.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/generateApi.spec.ts b/test/generateApi.spec.ts
new file mode 100644
index 0000000..c2a96e3
--- /dev/null
+++ b/test/generateApi.spec.ts
@@ -0,0 +1,13 @@
+import * as fs from "fs";
+import Kronikarz from "../dist";
+
+const k = new Kronikarz(__dirname + "/samples");
+
+test("generate single file", () => {
+  const dir = "./tmp";
+  k.generateApi(dir);
+  fs.readFile("./tmp/api/posts/2019/12/12/test.json", "utf-8", (err, data) => {
+    const parsedPost = JSON.parse(data);
+    expect(parsedPost.title).toBe("test");
+  });
+});