about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2017-07-01 13:40:31 +0200
committerAlan Pearce2017-07-01 13:40:31 +0200
commit31eda3eb3150c35b469ba193db227e0467653081 (patch)
tree9f2d1e457ada9c04f4a8b611b83c19b81ac46cc4
parent6fd0c4b95eb82e5c60b3740dabcfe4590fe78d82 (diff)
downloadhomestead-31eda3eb3150c35b469ba193db227e0467653081.tar.lz
homestead-31eda3eb3150c35b469ba193db227e0467653081.tar.zst
homestead-31eda3eb3150c35b469ba193db227e0467653081.zip
test: add description to basic tests
-rw-r--r--test/app.test.js47
1 files changed, 36 insertions, 11 deletions
diff --git a/test/app.test.js b/test/app.test.js
index d298a03..e0ddb87 100644
--- a/test/app.test.js
+++ b/test/app.test.js
@@ -29,11 +29,15 @@ test("homepage", t => {
     .expect(/^<!DOCTYPE html>/)
     .then(parseResponse)
     .then($ => {
-      t.is($("head > title").text(), "John Doe");
-      t.is($("h1").text(), "John Doe");
-      t.is($("main").length, 1);
-      t.is($("main .posts").length, 1);
-      t.is($(".post:first-of-type a").attr("href"), "/post/testfile");
+      t.is($("head > title").text(), "John Doe", "head title is site author");
+      t.is($("h1").text(), "John Doe", "h1 is site author");
+      t.is($("main").length, 1, "only one <main> tag");
+      t.is($("main .posts").length, 1, "contains one posts listing");
+      t.is(
+        $(".post:first-of-type a").attr("href"),
+        "/post/testfile",
+        "first post url"
+      );
       return $;
     })
     .then(toMicroformatsOptions)
@@ -67,13 +71,22 @@ test("post", t => {
     .expect(/^<!DOCTYPE html>/)
     .then(parseResponse)
     .then($ => {
-      t.is($("head > title").text(), "This is a test · " + "John Doe");
-      t.is($("article h1").text(), "This is a test");
+      t.is(
+        $("head > title").text(),
+        "This is a test · " + "John Doe",
+        "head title contains post and site author"
+      );
+      t.is(
+        $("article h1").text(),
+        "This is a test",
+        "article header is post title"
+      );
       t.is(
         $("article p").text(),
         `Ut enim blandit volutpat maecenas? Volutpat blandit aliquam etiam erat \
 velit, scelerisque in dictum non, consectetur a erat nam at lectus \
-urna duis convallis convallis tellus, id interdum velit laoreet!`
+urna duis convallis convallis tellus, id interdum velit laoreet!`,
+        "article has text"
       );
     });
 });
@@ -93,9 +106,21 @@ test("tags", t => {
     .expect(/^<!DOCTYPE html>/)
     .then(parseResponse)
     .then($ => {
-      t.is($("head > title").text(), "A · John Doe");
-      t.is($(".post a").text(), "This is a test");
-      t.is($(".post:first-of-type a").attr("href"), "/post/testfile");
+      t.is(
+        $("head > title").text(),
+        "A · John Doe",
+        "head title contains title-cased tag and site name"
+      );
+      t.is(
+        $(".post a").text(),
+        "This is a test",
+        "post link text is post title"
+      );
+      t.is(
+        $(".post:first-of-type a").attr("href"),
+        "/post/testfile",
+        "post url"
+      );
     });
 });