mirror of
https://github.com/typicode/json-server.git
synced 2025-07-28 12:43:18 +08:00
v0.9.0 (#404)
* Remove automatic type conversion * Remove body-parser from default middlewares * Ignore lib * ES2015 * Use shortid * Add babel-register * Update paths to ./lib * Add .npmignore * Update bin * temp fix * Fix bin * Add message when creating default db * Use fs.watch * Fix operator existence test * Fix 0.12 tests * Update dependencies * Update * Increase timeout * Fix 0.12 support * 0.9.0-beta.1 * Fix missing example.json issue * 0.9.0-beta.2 * Update message * Update CHANGELOG.md * Update lowdb dependency * Add error message * Update README.md * Add database validation * Update * Update * Fix tests * Update
This commit is contained in:
@ -1,30 +1,10 @@
|
||||
var assert = require('assert')
|
||||
var utils = require('../../src/server/utils')
|
||||
|
||||
/* global describe, it */
|
||||
const assert = require('assert')
|
||||
const utils = require('../../src/server/utils')
|
||||
|
||||
describe('utils', function () {
|
||||
describe('toNative', function () {
|
||||
it('should convert string to native type', function () {
|
||||
// should convert
|
||||
assert.strictEqual(utils.toNative('1'), 1)
|
||||
assert.strictEqual(utils.toNative('0'), 0)
|
||||
assert.strictEqual(utils.toNative('true'), true)
|
||||
// should not convert
|
||||
assert.strictEqual(utils.toNative(''), '')
|
||||
assert.strictEqual(utils.toNative('\t\n'), '\t\n')
|
||||
assert.strictEqual(utils.toNative('1 '), '1 ')
|
||||
assert.strictEqual(utils.toNative('01'), '01')
|
||||
assert.strictEqual(utils.toNative(' 1'), ' 1')
|
||||
assert.strictEqual(utils.toNative('string'), 'string')
|
||||
assert.strictEqual(utils.toNative(1), 1)
|
||||
assert.strictEqual(utils.toNative(true), true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('getPage', function () {
|
||||
var array = [1, 2, 3, 4, 5]
|
||||
var perPage = 2
|
||||
const array = [1, 2, 3, 4, 5]
|
||||
const perPage = 2
|
||||
|
||||
it('should return first page', function () {
|
||||
assert.deepEqual(
|
||||
|
Reference in New Issue
Block a user