Update coverage test

This commit is contained in:
CJ Patoilo 2016-12-01 03:00:48 -03:00
parent 0bc8494154
commit 8b1090a1d9
3 changed files with 96 additions and 141 deletions

View File

@ -51,17 +51,15 @@
},
"devDependencies": {
"autoprefixer": "^6.5.3",
"ava": "^0.17.0",
"backstopjs": "^2.3.3",
"browser-sync": "^2.18.1",
"coveralls": "^2.11.15",
"intelli-espower-loader": "^1.0.1",
"istanbul": "^0.4.5",
"mocha": "^3.1.2",
"node-sass": "^3.13.0",
"npm-run-all": "^2.3.0",
"nyc": "^10.0.0",
"onchange": "^2.5.0",
"postcss-cli": "^2.6.0",
"power-assert": "^1.4.2",
"sass-lint": "^1.10.2"
},
"engines": {
@ -78,8 +76,8 @@
"watch": "onchange src -- npm run build",
"serve": "browser-sync start --no-notify -s test --ss dist -f dist",
"start": "run-p watch serve",
"test": "run-s build coverage",
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- --require intelli-espower-loader test/unit/*.js",
"test": "run-s build",
"coverage": "nyc ava | coveralls",
"reference": "backstop reference --configPath=backstop.conf.js",
"compare": "backstop test --configPath=backstop.conf.js",
"backstop": "run-s build && run-p serve compare"

View File

@ -1,135 +0,0 @@
const assert = require('power-assert');
const npm = require('../../package.json');
const bower = require('../../bower.json');
const composer = require('../../composer.json');
const packages = [
npm,
bower,
composer
];
describe('Package', () => {
describe('Name', () => {
it(`should be equal "${npm.name}"`, () => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (compareValue.name.match('/')) compareValue.name = compareValue.name.split('/')[1]
if (referenceIndex !== compareIndex) assert(referenceValue.name === compareValue.name);
});
});
});
});
describe('Version', () => {
it(`should be equal to "v${npm.version}"`, () => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) assert(referenceValue.version === compareValue.version);
});
});
});
});
describe('Description', () => {
it(`should be equal to "${npm.description}"`, () => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) assert(referenceValue.description === compareValue.description);
});
});
});
});
describe('Homepage', () => {
it(`should be equal to "${npm.homepage}"`, () => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) assert(referenceValue.homepage === compareValue.homepage);
});
});
});
});
describe('Repository', () => {
it(`should be equal to "${npm.repository}"`, () => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) assert(referenceValue.repository === compareValue.repository);
});
});
});
});
describe('License', () => {
it(`should be equal to "${npm.license}"`, () => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) assert(referenceValue.license === compareValue.license);
});
});
});
});
describe('Author Name', () => {
it(`should be equal to "${npm.author}"`, () => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) assert(referenceValue.author === compareValue.author);
});
});
});
});
describe('Main File', () => {
it(`should be equal to "${npm.main}"`, () => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) assert(referenceValue.main === compareValue.main);
});
});
});
});
describe('Ignore', () => {
it('should be equal', () => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) assert(JSON.stringify(referenceValue.ignore) === JSON.stringify(compareValue.ignore));
});
});
});
});
describe('Keywords', () => {
it('should be equal', () => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) assert(JSON.stringify(referenceValue.keywords) === JSON.stringify(compareValue.keywords));
});
});
});
});
});

92
test/unit/packages.js Normal file
View File

@ -0,0 +1,92 @@
const test = require('ava');
const npm = require('../../package.json');
const bower = require('../../bower.json');
const composer = require('../../composer.json');
const packages = [
npm,
bower,
composer
];
test(`Name should be equal "${npm.name}"`, t => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (compareValue.name.match('/')) compareValue.name = compareValue.name.split('/')[1]
if (referenceIndex !== compareIndex) t.is(referenceValue.name, compareValue.name);
});
});
});
test(`Version should be equal to "v${npm.version}"`, t => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) t.is(referenceValue.version, compareValue.version);
});
});
});
test(`Description should be equal to "${npm.description}"`, t => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) t.is(referenceValue.description, compareValue.description);
});
});
});
test(`Homepage should be equal to "${npm.homepage}"`, t => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) t.is(referenceValue.homepage, compareValue.homepage);
});
});
});
test(`Repository should be equal to "${npm.repository}"`, t => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) t.is(referenceValue.repository, compareValue.repository);
});
});
});
test(`License should be equal to "${npm.license}"`, t => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) t.is(referenceValue.license, compareValue.license);
});
});
});
test(`Author Name should be equal to "${npm.author}"`, t => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) t.is(referenceValue.author, compareValue.author);
});
});
});
test(`Main File should be equal to "${npm.main}"`, t => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) t.is(referenceValue.main, compareValue.main);
});
});
});
test('Ignore should be equal', t => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) t.is(JSON.stringify(referenceValue.ignore), JSON.stringify(compareValue.ignore));
});
});
});
test('Keywords should be equal', t => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) t.is(JSON.stringify(referenceValue.keywords), JSON.stringify(compareValue.keywords));
});
});
});