1 | require './setup'
|
2 |
|
3 | describe 'Express', ->
|
4 | StyledownHandler = require('../connect')
|
5 | Request = require('supertest')
|
6 | Expect = chai.expect
|
7 | Express = require('express')
|
8 |
|
9 | before ->
|
10 | @app = Express()
|
11 | @app.use StyledownHandler
|
12 | root: __dirname
|
13 | guides:
|
14 | index: 'fixtures/sample.md'
|
15 |
|
16 | it '.css', (done) ->
|
17 | Request(@app)
|
18 | .get('/styleguides/styledown.css')
|
19 | .expect(200)
|
20 | .expect('Content-Type', 'text/css')
|
21 | .end (err, res) ->
|
22 | expect(res.text).length.gt 10
|
23 | done(err)
|
24 |
|
25 | it '.js', (done) ->
|
26 | Request(@app)
|
27 | .get('/styleguides/styledown.js')
|
28 | .expect(200)
|
29 | .expect('Content-Type', 'application/javascript')
|
30 | .end (err, res) ->
|
31 | expect(res.text).length.gt 10
|
32 | done(err)
|
33 |
|
34 | it 'index', (done) ->
|
35 | Request(@app)
|
36 | .get('/styleguides/index')
|
37 | .expect(200)
|
38 | .end (err, res) ->
|
39 | expect(res.text).match /meta charset/
|
40 | expect(res.text).match /Hello there from sample.md/
|
41 | done(err)
|
42 |
|
43 | it 'not found', (done) ->
|
44 | Request(@app)
|
45 | .get('/styleguides/ueeu')
|
46 | .expect(404)
|
47 | .end(done)
|