about summary refs log tree commit diff stats
path: root/test/app.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/app.test.js')
-rw-r--r--test/app.test.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/test/app.test.js b/test/app.test.js
index 2445493..ac0ce2d 100644
--- a/test/app.test.js
+++ b/test/app.test.js
@@ -9,7 +9,9 @@ const mf = require("microformat-node");
 process.chdir(path.resolve(__dirname, "./testsite/"));
 const config = require(path.resolve(__dirname, "../src/modules/config.js"));
 
-const app = require("../src/app.js");
+const App = require("../src/app.js");
+let app;
+test.before(async t => (app = await App()));
 
 const parseResponse = res =>
   cheerio.load(res.text, {
@@ -52,7 +54,8 @@ test("homepage", async function(t) {
   t.deepEqual(count, {
     "h-card": 1,
     "h-feed": 1,
-    "h-entry": 1
+    "h-entry": 1,
+    rels: 1
   });
 
   const data = await mf.getAsync(options);
@@ -82,7 +85,8 @@ test("post", async function(t) {
 
   t.deepEqual(count, {
     "h-card": 1,
-    "h-entry": 1
+    "h-entry": 1,
+    rels: 1
   });
 
   const data = await mf.getAsync(options);
@@ -111,7 +115,8 @@ test("tags", async function(t) {
   t.deepEqual(count, {
     "h-card": 1,
     "h-feed": 1,
-    "h-entry": 1
+    "h-entry": 1,
+    rels: 1
   });
 
   const data = await mf.getAsync(options);
@@ -119,5 +124,14 @@ test("tags", async function(t) {
   t.snapshot(data, "should contain relevant microformats data");
 });
 
+test("highlight css", async function(t) {
+  const res = await request(app.listen()).get("/css/code.css");
+
+  t.is(res.statusCode, 200);
+  t.is(res.type, "text/css");
+  t.is(res.charset, "utf-8");
+  t.regex(res.text, /^\.hljs/m);
+});
+
 test(notFound, "/post/non-existent", /Post not found/);
 test(notFound, "/tag/non-existent", /tag non-existent not found/);