milligram/test/unit/package-spec.js

136 lines
3.4 KiB
JavaScript
Raw Normal View History

2016-11-22 22:27:09 +00:00
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', () => {
2016-11-23 00:43:43 +00:00
it(`should be equal "${npm.name}"`, () => {
2016-11-22 22:27:09 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
2016-11-23 00:43:43 +00:00
if (compareValue.name.match('/')) compareValue.name = compareValue.name.split('/')[1]
if (referenceIndex !== compareIndex) assert(referenceValue.name === compareValue.name);
2016-11-22 22:27:09 +00:00
});
});
});
});
describe('Version', () => {
2016-11-23 00:43:43 +00:00
it(`should be equal to "v${npm.version}"`, () => {
2016-11-22 22:27:09 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
2016-11-23 00:43:43 +00:00
if (referenceIndex !== compareIndex) assert(referenceValue.version === compareValue.version);
2016-11-22 22:27:09 +00:00
});
});
});
});
describe('Description', () => {
2016-11-23 00:43:43 +00:00
it(`should be equal to "${npm.description}"`, () => {
2016-11-22 22:27:09 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
2016-11-23 00:43:43 +00:00
if (referenceIndex !== compareIndex) assert(referenceValue.description === compareValue.description);
2016-11-22 22:27:09 +00:00
});
});
});
});
describe('Homepage', () => {
2016-11-23 00:43:43 +00:00
it(`should be equal to "${npm.homepage}"`, () => {
2016-11-22 22:27:09 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
2016-11-23 00:43:43 +00:00
if (referenceIndex !== compareIndex) assert(referenceValue.homepage === compareValue.homepage);
2016-11-22 22:27:09 +00:00
});
});
});
});
describe('Repository', () => {
2016-11-23 00:43:43 +00:00
it(`should be equal to "${npm.repository}"`, () => {
2016-11-22 22:27:09 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
2016-11-23 00:43:43 +00:00
if (referenceIndex !== compareIndex) assert(referenceValue.repository === compareValue.repository);
2016-11-22 22:27:09 +00:00
});
});
});
});
describe('License', () => {
2016-11-23 00:43:43 +00:00
it(`should be equal to "${npm.license}"`, () => {
2016-11-22 22:27:09 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
2016-11-23 00:43:43 +00:00
if (referenceIndex !== compareIndex) assert(referenceValue.license === compareValue.license);
2016-11-22 22:27:09 +00:00
});
});
});
});
describe('Author Name', () => {
2016-11-23 00:43:43 +00:00
it(`should be equal to "${npm.author}"`, () => {
2016-11-22 22:27:09 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
2016-11-23 00:43:43 +00:00
if (referenceIndex !== compareIndex) assert(referenceValue.author === compareValue.author);
2016-11-22 22:27:09 +00:00
});
});
});
});
describe('Main File', () => {
2016-11-23 00:43:43 +00:00
it(`should be equal to "${npm.main}"`, () => {
2016-11-22 22:27:09 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
2016-11-23 00:43:43 +00:00
if (referenceIndex !== compareIndex) assert(referenceValue.main === compareValue.main);
2016-11-22 22:27:09 +00:00
});
});
});
});
describe('Ignore', () => {
2016-11-22 22:40:59 +00:00
it('should be equal', () => {
2016-11-22 22:27:09 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
2016-11-23 00:43:43 +00:00
if (referenceIndex !== compareIndex) assert(JSON.stringify(referenceValue.ignore) === JSON.stringify(compareValue.ignore));
2016-11-22 22:27:09 +00:00
});
});
});
});
describe('Keywords', () => {
2016-11-22 22:40:59 +00:00
it('should be equal', () => {
2016-11-22 22:27:09 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
2016-11-23 00:43:43 +00:00
if (referenceIndex !== compareIndex) assert(JSON.stringify(referenceValue.keywords) === JSON.stringify(compareValue.keywords));
2016-11-22 22:27:09 +00:00
});
});
});
});
});