Added unit test and coveralls

This commit is contained in:
CJ Patoilo 2016-11-22 19:27:09 -03:00
parent f6657df79f
commit af1d3fc26a
7 changed files with 150 additions and 0 deletions

1
.coveralls.yml Normal file
View File

@ -0,0 +1 @@
repo_token: m1BEx78tPMAxcADSCK5vtqLfzdj5oU82P

View File

@ -1,3 +1,5 @@
.coveralls.yml
.editorconfig
.github
.gitignore

View File

@ -28,6 +28,7 @@
"stylus"
],
"ignore": [
".coveralls.yml",
".editorconfig",
".github",
".gitignore",

View File

@ -28,6 +28,7 @@
"stylus"
],
"ignore": [
".coveralls.yml",
".editorconfig",
".github",
".gitignore",

View File

@ -28,6 +28,7 @@
"stylus"
],
"ignore": [
".coveralls.yml",
".editorconfig",
".github",
".gitignore",

View File

@ -28,6 +28,7 @@
"stylus"
],
"ignore": [
".coveralls.yml",
".editorconfig",
".github",
".gitignore",
@ -51,10 +52,15 @@
"autoprefixer": "^6.5.3",
"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",
"onchange": "^2.5.0",
"postcss-cli": "^2.6.0",
"power-assert": "^1.4.2",
"sass-lint": "^1.10.2"
},
"engines": {
@ -72,6 +78,7 @@
"serve": "browser-sync start --no-notify -s test --ss dist -f dist",
"start": "run-p watch serve",
"test": "run-s build",
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- --require intelli-espower-loader test/unit/*.js",
"reference": "backstop reference --configPath=backstop.conf.js",
"compare": "backstop test --configPath=backstop.conf.js",
"backstop": "run-s build && run-p serve compare"

137
test/unit/package-spec.js Normal file
View File

@ -0,0 +1,137 @@
const fs = require('fs');
const assert = require('power-assert');
const npm = require('../../package.json');
const bower = require('../../bower.json');
const component = require('../../component.json');
const composer = require('../../composer.json');
const packages = [
npm,
bower,
component,
composer
];
describe('Package', () => {
describe('Name', () => {
it(`should be equal to ${npm.name}`, () => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
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(referenceValue.ignore, compareValue.ignore);
});
});
});
});
describe('Keywords', () => {
it(`should be equal`, () => {
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex) assert(referenceValue.keywords, compareValue.keywords);
});
});
});
});
});