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-28 17:53:55 +0100
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2020-01-28 17:53:55 +0100
commit1a5e99c7972968cc384c8dd94bbb92f9c9beac3b (patch)
treeeeb47ac09b408e386b13cfc93ec9da582d17fbaa /test/generateApi.spec.ts
parent74ee8edb555ef128112378f828c636bc04533b31 (diff)
downloadkronikarz-1a5e99c7972968cc384c8dd94bbb92f9c9beac3b.tar.gz
kronikarz-1a5e99c7972968cc384c8dd94bbb92f9c9beac3b.zip
Add categories
Diffstat (limited to 'test/generateApi.spec.ts')
-rw-r--r--test/generateApi.spec.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/generateApi.spec.ts b/test/generateApi.spec.ts
index bf63b6e..f22c8e4 100644
--- a/test/generateApi.spec.ts
+++ b/test/generateApi.spec.ts
@@ -2,12 +2,21 @@ import * as fs from "fs";
 import Kronikarz from "../dist";
 
 const k = new Kronikarz(__dirname + "/samples");
+const dir = "./tmp";
 
 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");
   });
 });
+
+test("categories", () => {
+    k.generateApi(dir)
+    fs.readFile(`${dir}/api/category/test-category.json`, "utf-8", (err, data) => {
+        const posts = JSON.parse(data)
+        expect(posts.length).toBe(1)
+        expect(posts[0].content).toBe(undefined)
+    })
+})