summary refs log tree commit diff stats
path: root/test/index.test.js
blob: e13e52ccd81135ee2ae8aaf5199e92011f1f0ff0 (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
const test = require('ava')
const path = require('path')
const request = require('supertest')

process.env.POST_DIR = path.resolve(__dirname, '../test/data/')
const app = require('../src/index.js')

test('homepage', t => {
  return request(app.listen())
    .get('/')
    .expect(200)
    .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('/tags/a')
    .expect(200)
    .expect(/This is a test/)
    .then(() => t.pass())
})