diff options
author | Alan Pearce | 2017-07-04 21:03:24 +0200 |
---|---|---|
committer | Alan Pearce | 2017-07-04 21:03:24 +0200 |
commit | 9d601e206bdad2c384f2328a14fea8c0f5428ca9 (patch) | |
tree | f83086a1139ea84393ebe30436f30205f9750024 /test/app.test.js | |
parent | e7b08b1dfe3f2a2596deb6e2a72bb79805d3708f (diff) | |
download | homestead-9d601e206bdad2c384f2328a14fea8c0f5428ca9.tar.lz homestead-9d601e206bdad2c384f2328a14fea8c0f5428ca9.tar.zst homestead-9d601e206bdad2c384f2328a14fea8c0f5428ca9.zip |
feat: Add posts listing
Diffstat (limited to 'test/app.test.js')
-rw-r--r-- | test/app.test.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/app.test.js b/test/app.test.js index ac0ce2d..1f8e72f 100644 --- a/test/app.test.js +++ b/test/app.test.js @@ -63,6 +63,37 @@ test("homepage", async function(t) { t.snapshot(data, "should contain relevant microformats data"); }); +test("posts", async function(t) { + const res = await request(app.listen()).get("/post/"); + + t.is(res.statusCode, 200); + t.is(res.type, "text/html"); + t.is(res.charset, "utf-8"); + t.regex(res.text, /^<!DOCTYPE html>/); + + const $ = parseResponse(res); + + t.is( + $("head > title").text(), + "Posts ยท " + "John Doe", + "head title contains 'Posts' and site author" + ); + + const options = toMicroformatsOptions($); + const count = await mf.countAsync(options); + + t.deepEqual(count, { + "h-card": 1, + "h-feed": 1, + "h-entry": 1, + rels: 1 + }); + + const data = await mf.getAsync(options); + + t.snapshot(data, "should contain relevant microformats data"); +}); + test("post", async function(t) { const res = await request(app.listen()).get("/post/testfile"); |