summary refs log tree commit diff
path: root/test/generateApi.spec.ts
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2020-01-03 00:24:34 +0100
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2020-01-03 00:24:34 +0100
commitc11d7a84aa59e9b1179a9834129b2d776bab8bca (patch)
treec5c053ace0b8fca3c74fee360036bf1e2efd1c2c /test/generateApi.spec.ts
parent7b8d75cd87e392d9ffb3defa538a041c4f7e0f0c (diff)
downloadkronikarz-c11d7a84aa59e9b1179a9834129b2d776bab8bca.tar.gz
kronikarz-c11d7a84aa59e9b1179a9834129b2d776bab8bca.zip
Add post endpoints
Diffstat (limited to 'test/generateApi.spec.ts')
-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");
+  });
+});