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 | 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(/Lorem ipsum/) .then(() => t.pass()) }) |