summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--config/default.toml2
-rw-r--r--src/responders.js8
-rw-r--r--src/templates/layout.html4
-rw-r--r--test/app.test.js37
4 files changed, 40 insertions, 11 deletions
diff --git a/config/default.toml b/config/default.toml
index acda778..9db7540 100644
--- a/config/default.toml
+++ b/config/default.toml
@@ -2,7 +2,7 @@
 port = 3000
 
 [site]
-title = "Test Site"
+author = "John Doe"
 
 [posts]
 folder = "./posts"
diff --git a/src/responders.js b/src/responders.js
index acfcaf1..7671141 100644
--- a/src/responders.js
+++ b/src/responders.js
@@ -80,7 +80,7 @@ module.exports = {
         .inner(".posts", function(postsTemplate) {
           return postsStream.pipe(postsTemplate.map(renderPostListItem(ctx)));
         })
-        .pipe(setTitle(config.site.title))
+        .pipe(setTitle(config.site.author))
         .render()
     );
   },
@@ -94,7 +94,7 @@ module.exports = {
         .outer("main", showPage("post"))
         .inner("article h1", rheo(post.data.get("title")))
         .outer("article main", rheo(post.body))
-        .pipe(setTitle(config.site.title, post.data.get("title")))
+        .pipe(setTitle(config.site.author, post.data.get("title")))
         .render()
     );
   },
@@ -106,11 +106,11 @@ module.exports = {
         .layout()
         .pipe(rheo())
         .outer("main", showPage("taxon"))
-        .inner("h1", rheo(config.site.title))
+        .inner("h1", rheo(config.site.author))
         .inner(".posts", function(postsTemplate) {
           return taxonItems.pipe(postsTemplate.map(renderPostListItem(ctx)));
         })
-        .pipe(setTitle(config.site.title))
+        .pipe(setTitle(config.site.author))
         .render()
     );
   }
diff --git a/src/templates/layout.html b/src/templates/layout.html
index 994ce02..7856917 100644
--- a/src/templates/layout.html
+++ b/src/templates/layout.html
@@ -5,8 +5,8 @@
     <title></title>
   </head>
   <body>
-    <header>
-      <h1>hello world</h1>
+    <header class="h-card">
+      <h1 class="p-name">hello world</h1>
     </header>
     <main></main>
   </body>
diff --git a/test/app.test.js b/test/app.test.js
index b2f91d1..74aeac5 100644
--- a/test/app.test.js
+++ b/test/app.test.js
@@ -1,7 +1,10 @@
+"use strict";
+
 const test = require("ava");
 const path = require("path");
 const request = require("supertest");
 const cheerio = require("cheerio");
+const mf = require("microformat-node");
 
 process.chdir(path.resolve(__dirname, "./testsite/"));
 const config = require(path.resolve(__dirname, "../src/modules/config.js"));
@@ -14,6 +17,11 @@ const parseResponse = res =>
     useHtmlParser2: true
   });
 
+const toMicroformatsOptions = node => ({
+  node,
+  textFormat: "normalised"
+});
+
 test("homepage", t => {
   return request(app.listen())
     .get("/")
@@ -21,10 +29,31 @@ test("homepage", t => {
     .expect(/^<!DOCTYPE html>/)
     .then(parseResponse)
     .then($ => {
-      t.is($("head > title").text(), config.site.title);
-      t.is($("h1").text(), config.site.title);
+      t.is($("head > title").text(), "John Doe");
+      t.is($("h1").text(), "John Doe");
       t.is($("main").length, 1);
-    });
+      return $;
+    })
+    .then(toMicroformatsOptions)
+    .then(options =>
+      Promise.all([
+        mf.countAsync(options).then(count =>
+          t.deepEqual(count, {
+            "h-card": 1
+          })
+        ),
+        mf.getAsync(options).then(data => {
+          t.deepEqual(data.items, [
+            {
+              properties: {
+                name: ["John Doe"]
+              },
+              type: ["h-card"]
+            }
+          ]);
+        })
+      ])
+    );
 });
 
 test("post", t => {
@@ -34,7 +63,7 @@ test("post", t => {
     .expect(/^<!DOCTYPE html>/)
     .then(parseResponse)
     .then($ => {
-      t.is($("head > title").text(), "This is a test · " + config.site.title);
+      t.is($("head > title").text(), "This is a test · " + "John Doe");
       t.is($("article h1").text(), "This is a test");
       t.is(
         $("article p").text(),