From e7b08b1dfe3f2a2596deb6e2a72bb79805d3708f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 3 Jul 2017 21:39:43 +0200 Subject: feat: Add code block highlighting Theme is configurable --- test/app.test.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'test/app.test.js') 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/); -- cgit 1.4.1