mirror of
https://github.com/typicode/json-server.git
synced 2025-07-28 04:32:24 +08:00
lint
This commit is contained in:
@ -49,4 +49,4 @@ function getPage (array, page, perPage) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
}
|
}
|
||||||
|
@ -268,19 +268,18 @@ describe('Server', function () {
|
|||||||
|
|
||||||
describe('GET /:resource?_page=&_limit=', function () {
|
describe('GET /:resource?_page=&_limit=', function () {
|
||||||
it('should paginate with a custom limit', function (done) {
|
it('should paginate with a custom limit', function (done) {
|
||||||
|
var link = [
|
||||||
|
'<http://localhost/list?_page=1&_limit=1>; rel="first"',
|
||||||
|
'<http://localhost/list?_page=1&_limit=1>; rel="prev"',
|
||||||
|
'<http://localhost/list?_page=3&_limit=1>; rel="next"',
|
||||||
|
'<http://localhost/list?_page=15&_limit=1>; rel="last"'
|
||||||
|
].join(', ')
|
||||||
request(server)
|
request(server)
|
||||||
.get('/list?_page=2&_limit=1')
|
.get('/list?_page=2&_limit=1')
|
||||||
.set('host', 'localhost')
|
.set('host', 'localhost')
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
.expect('x-total-count', db.list.length.toString())
|
.expect('x-total-count', db.list.length.toString())
|
||||||
.expect('link',
|
.expect('link', link)
|
||||||
[
|
|
||||||
'<http://localhost/list?_page=1&_limit=1>; rel="first"',
|
|
||||||
'<http://localhost/list?_page=1&_limit=1>; rel="prev"',
|
|
||||||
'<http://localhost/list?_page=3&_limit=1>; rel="next"',
|
|
||||||
'<http://localhost/list?_page=15&_limit=1>; rel="last"'
|
|
||||||
].join(', ')
|
|
||||||
)
|
|
||||||
.expect('Access-Control-Expose-Headers', 'X-Total-Count')
|
.expect('Access-Control-Expose-Headers', 'X-Total-Count')
|
||||||
.expect(db.list.slice(1, 2))
|
.expect(db.list.slice(1, 2))
|
||||||
.expect(200, done)
|
.expect(200, done)
|
||||||
|
Reference in New Issue
Block a user