mirror of
https://github.com/typicode/json-server.git
synced 2025-08-02 19:52:20 +08:00
Add static option
This commit is contained in:
1
test/cli/fixtures/public/index.html
Normal file
1
test/cli/fixtures/public/index.html
Normal file
@ -0,0 +1 @@
|
||||
Hello
|
@ -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') {
|
||||
|
@ -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'
|
||||
|
@ -19,6 +19,7 @@ describe('Server', function () {
|
||||
|
||||
server = jsonServer.create()
|
||||
router = jsonServer.router(db)
|
||||
server.use(jsonServer.defaults())
|
||||
server.use(router)
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user