-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtests.js
35 lines (29 loc) · 987 Bytes
/
tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict';
const chai = require('chai');
const isPlainObj = require('is-plain-obj');
const config = require('./../index.js');
const lint = require('./helper/testHelper.js');
const should = chai.should();
describe('npm-package-json-lint config tests', () => {
context('npm-package-json-lint config object', () => {
it('should be an object', () => {
isPlainObj(config).should.equal(true);
});
});
context('rules', () => {
it('should be an object', () => {
isPlainObj(config.rules).should.equal(true);
});
});
context('run npm-package-json-lint and make sure it runs', () => {
it('npm-package-json-lint should run without failing', () => {
const packageJsonData = {
author: 'Caitlin Snow'
};
const results = lint(packageJsonData, config);
const expectedErrorCount = 2;
results.errors.length.should.equal(expectedErrorCount);
results.hasOwnProperty('warnings').should.be.false;
});
});
});