Merge pull request #87 from xuexb/fix/test

fix: 修改测试报错
This commit is contained in:
前端小武 2017-11-28 10:53:23 +08:00 committed by GitHub
commit 4a13968a0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -12,6 +12,7 @@ cache:
directories: directories:
- node_modules - node_modules
script: script:
- npm run test:cov && npm run test:sauce - npm run test:cov
- npm run test:sauce
after_script: after_script:
- npm install coveralls && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage - npm install coveralls && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage

View File

@ -346,17 +346,14 @@ describe('layui', function () {
]; ];
it('check params and return value', function () { it('check params and return value', function () {
// 由于没有值参数, 导致 JSON.parse 失败 expect(layui.sort()).to.deep.equal([], '空参数时默认为空数组');
expect(function () {
layui.sort();
}).to.throw();
expect(layui.sort({})).to.deep.equal({}); expect(layui.sort({})).to.deep.equal({}, '只传空对象默认返回');
expect(layui.sort({ expect(layui.sort({
name: 'layui' name: 'layui'
})).to.deep.equal({ })).to.deep.equal({
name: 'layui' name: 'layui'
}); }, '只传一个对象参数时返回');
expect(layui.sort([{ expect(layui.sort([{
name: 'layui' name: 'layui'