-
Notifications
You must be signed in to change notification settings - Fork 63
/
express_test.coffee
47 lines (41 loc) · 1.1 KB
/
express_test.coffee
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
35
36
37
38
39
40
41
42
43
44
45
46
47
require './setup'
describe 'Express', ->
StyledownHandler = require('../connect')
Request = require('supertest')
Expect = chai.expect
Express = require('express')
before ->
@app = Express()
@app.use StyledownHandler
root: __dirname
guides:
index: 'fixtures/sample.md'
it '.css', (done) ->
Request(@app)
.get('/styleguides/styledown.css')
.expect(200)
.expect('Content-Type', 'text/css')
.end (err, res) ->
expect(res.text).length.gt 10
done(err)
it '.js', (done) ->
Request(@app)
.get('/styleguides/styledown.js')
.expect(200)
.expect('Content-Type', 'application/javascript')
.end (err, res) ->
expect(res.text).length.gt 10
done(err)
it 'index', (done) ->
Request(@app)
.get('/styleguides/index')
.expect(200)
.end (err, res) ->
expect(res.text).match /meta charset/
expect(res.text).match /Hello there from sample.md/
done(err)
it 'not found', (done) ->
Request(@app)
.get('/styleguides/ueeu')
.expect(404)
.end(done)