all repos — archive/homestead @ 33171a749162685e42650f82041cd2af0136718d

My future indieweb platform

test/index.test.js (view raw)

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())
})