mirror of
https://github.com/typicode/json-server.git
synced 2025-07-28 12:43:18 +08:00
Refactor code and tests
This commit is contained in:
@ -46,28 +46,4 @@ describe('utils', function() {
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
describe('limitArray', function() {
|
||||
it('should return limited array', function() {
|
||||
var testArray = [
|
||||
{id: 2, postId: 2},
|
||||
{id: 3, postId: 4},
|
||||
{id: 4, postId: 6},
|
||||
{id: 5, postId: 8},
|
||||
{id: 6, postId: 9},
|
||||
{id: 7, postId: 10},
|
||||
{id: 8, postId: 11},
|
||||
{id: 9, postId: 12},
|
||||
{id: 10, postId: 13},
|
||||
{id: 11, postId: 14},
|
||||
{id: 12, postId: 15},
|
||||
{id: 13, postId: 16},
|
||||
{id: 14, postId: 17},
|
||||
{id: 15, postId: 18},
|
||||
{id: 16, postId: 19}
|
||||
]
|
||||
assert.deepEqual(utils.limitArray(testArray, 3, 3), testArray.slice(3, 6))
|
||||
assert.deepEqual(utils.limitArray(testArray, 5, 3), testArray.slice(5, 8))
|
||||
})
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user