summary refs log tree commit diff stats
path: root/test/app.test.js
diff options
context:
space:
mode:
authorAlan Pearce2017-06-24 16:34:47 +0200
committerAlan Pearce2017-06-24 16:34:47 +0200
commitbdd6610208e9fe5971e6aed4378598092f2b9b5a (patch)
treedcb9d6c9ad8f3d91ca93106dce980e5a6012d517 /test/app.test.js
parent6b02186505264dc5a05a74bce1f9dcc3f91d08e1 (diff)
downloadhomestead-bdd6610208e9fe5971e6aed4378598092f2b9b5a.tar.lz
homestead-bdd6610208e9fe5971e6aed4378598092f2b9b5a.tar.zst
homestead-bdd6610208e9fe5971e6aed4378598092f2b9b5a.zip
refactor: separate app, responders
Diffstat (limited to 'test/app.test.js')
-rw-r--r--test/app.test.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/app.test.js b/test/app.test.js
new file mode 100644
index 0000000..04596fa
--- /dev/null
+++ b/test/app.test.js
@@ -0,0 +1,34 @@
+const test = require('ava')
+const path = require('path')
+const request = require('supertest')
+
+const config = require('../src/modules/config.js')
+config.posts.folder = path.resolve(__dirname, './data/')
+
+const app = require('../src/app.js')
+
+test('homepage', t => {
+  return request(app.listen())
+    .get('/')
+    .expect(200)
+    .expect(/<title>Test Site<\/title>/)
+    .expect(/<h1>Test Site<\/h1>/)
+    .expect(/This is a test/)
+    .then(() => t.pass())
+})
+
+test('post', t => {
+  return request(app.listen())
+    .get('/post/testfile')
+    .expect(200)
+    .expect(/<h1>Lorem ipsum<\/h1>/)
+    .then(() => t.pass())
+})
+
+test('tags', t => {
+  return request(app.listen())
+    .get('/tag/a')
+    .expect(200)
+    .expect(/This is a test/)
+    .then(() => t.pass())
+})