milligram/test/unit/packages.js

105 lines
3.1 KiB
JavaScript
Raw Normal View History

2017-01-24 20:20:25 +00:00
const test = require('ava')
const npm = require('../../package.json')
const bower = require('../../bower.json')
const composer = require('../../composer.json')
2016-12-01 06:00:48 +00:00
2020-05-15 04:20:35 +00:00
const packages = [npm, bower, composer]
2016-12-01 06:00:48 +00:00
test(`Name should be equal "${npm.name}"`, t => {
2020-05-15 04:20:35 +00:00
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)
})
})
2017-01-24 20:20:25 +00:00
})
2016-12-01 06:00:48 +00:00
test(`Version should be equal to "v${npm.version}"`, t => {
2020-05-15 04:20:35 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex)
t.is(referenceValue.version, compareValue.version)
})
})
2017-01-24 20:20:25 +00:00
})
2016-12-01 06:00:48 +00:00
test(`Description should be equal to "${npm.description}"`, t => {
2020-05-15 04:20:35 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex)
t.is(referenceValue.description, compareValue.description)
})
})
2017-01-24 20:20:25 +00:00
})
2016-12-01 06:00:48 +00:00
test(`Homepage should be equal to "${npm.homepage}"`, t => {
2020-05-15 04:20:35 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex)
t.is(referenceValue.homepage, compareValue.homepage)
})
})
2017-01-24 20:20:25 +00:00
})
2016-12-01 06:00:48 +00:00
test(`Repository should be equal to "${npm.repository}"`, t => {
2020-05-15 04:20:35 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex)
t.is(referenceValue.repository, compareValue.repository)
})
})
2017-01-24 20:20:25 +00:00
})
2016-12-01 06:00:48 +00:00
test(`License should be equal to "${npm.license}"`, t => {
2020-05-15 04:20:35 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex)
t.is(referenceValue.license, compareValue.license)
})
})
2017-01-24 20:20:25 +00:00
})
2016-12-01 06:00:48 +00:00
test(`Author Name should be equal to "${npm.author}"`, t => {
2020-05-15 04:20:35 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex)
t.is(referenceValue.author, compareValue.author)
})
})
2017-01-24 20:20:25 +00:00
})
2016-12-01 06:00:48 +00:00
test(`Main File should be equal to "${npm.main}"`, t => {
2020-05-15 04:20:35 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex)
t.is(referenceValue.main, compareValue.main)
})
})
2017-01-24 20:20:25 +00:00
})
2016-12-01 06:00:48 +00:00
test('Ignore should be equal', t => {
2020-05-15 04:20:35 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex)
t.is(
JSON.stringify(referenceValue.ignore),
JSON.stringify(compareValue.ignore)
)
})
})
2017-01-24 20:20:25 +00:00
})
2016-12-01 06:00:48 +00:00
test('Keywords should be equal', t => {
2020-05-15 04:20:35 +00:00
packages.map((referenceValue, referenceIndex) => {
packages.map((compareValue, compareIndex) => {
if (referenceIndex !== compareIndex)
t.is(
JSON.stringify(referenceValue.keywords),
JSON.stringify(compareValue.keywords)
)
})
})
2017-01-24 20:20:25 +00:00
})