1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-12-26 01:13:41 +02:00
simple-icons/tests/index.test.js
Sachin Raja d49492f1ef
switch from uvu to mocha (#7071)
* switch from uvu to mocha

* remove unused import

* custom min reporter

* use constants
2022-01-19 18:23:32 +01:00

29 lines
801 B
JavaScript

import simpleIcons from '../index.js';
import { getIconSlug, getIconsData } from '../scripts/utils.js';
import { test } from 'mocha';
import { strict as assert } from 'node:assert';
(async () => {
const icons = await getIconsData();
icons.forEach((icon) => {
const slug = getIconSlug(icon);
test(`'Get' ${icon.title} by its slug`, () => {
const found = simpleIcons.Get(slug);
assert.ok(found);
assert.equal(found.title, icon.title);
assert.equal(found.hex, icon.hex);
assert.equal(found.source, icon.source);
});
});
test(`Iterating over simpleIcons only exposes icons`, () => {
const iconArray = Object.values(simpleIcons);
for (let icon of iconArray) {
assert.ok(icon);
assert.equal(typeof icon, 'object');
}
});
})();