From 31eda3eb3150c35b469ba193db227e0467653081 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 1 Jul 2017 13:40:31 +0200 Subject: test: add description to basic tests --- test/app.test.js | 47 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) (limited to 'test') 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(/^/) .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
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(/^/) .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(/^/) .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" + ); }); }); -- cgit 1.4.1