Add static option

This commit is contained in:
Typicode
2015-09-19 10:48:56 +02:00
parent 6610adbf05
commit 6c6333fa6d
9 changed files with 97 additions and 37 deletions

View File

@ -0,0 +1 @@
Hello

View File

@ -70,9 +70,9 @@ describe('cli', function () {
describe('http://jsonplaceholder.typicode.com/db', function () {
beforeEach(function (done) {
this.timeout(10000)
child = cli(['http://jsonplaceholder.typicode.com/db'])
setTimeout(done, 9000)
this.timeout(10000)
serverReady(PORT, done)
})
it('should support URL file', function (done) {
@ -111,6 +111,19 @@ describe('cli', function () {
})
describe('db.json -s fixtures/public', function () {
beforeEach(function (done) {
child = cli([dbFile, '-s', 'fixtures/public'])
serverReady(PORT, done)
})
it('should serve fixtures/public', function (done) {
request.get('/').expect(/Hello/, done)
})
})
// FIXME test fails on OS X and maybe on Windows
// But manually updating db.json works...
if (os.platform() === 'linux') {

View File

@ -49,7 +49,7 @@ describe('Server', function () {
server = jsonServer.create()
router = jsonServer.router(db)
server.use(jsonServer.defaults)
server.use(jsonServer.defaults())
server.use(jsonServer.rewriter({
'/api/': '/',
'/blog/posts/:id/show': '/posts/:id'

View File

@ -19,6 +19,7 @@ describe('Server', function () {
server = jsonServer.create()
router = jsonServer.router(db)
server.use(jsonServer.defaults())
server.use(router)
})