blob: 73bbd194b5345416f89d9fdcc0383cdf6b0fd80f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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/index.js')
test('homepage', t => {
return request(app.listen())
.get('/')
.expect(200)
.expect(/<title>Test Site<\/title>/)
.expect(/hello world/)
.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())
})
|