mirror of
https://github.com/simple-icons/simple-icons.git
synced 2024-11-16 00:59:07 +02:00
a930dc57ec
* convert scripts to esm * fix tests * fix tests * fix lints * syncFs to fsSync * named export for fs Co-authored-by: LitoMore <LitoMore@users.noreply.github.com> * fsSync to { promises as fs } * convert update-svgs-count to esm * rename data to icons * fix build script * switch svglintrc file to mjs * use node: protocol * pluralize getIcons Co-authored-by: LitoMore <LitoMore@users.noreply.github.com>
33 lines
804 B
JavaScript
33 lines
804 B
JavaScript
import simpleIcons from '../index.js';
|
|
import { getIconSlug, getIconsData } from '../scripts/utils.js';
|
|
import { test, exec } from 'uvu';
|
|
import * as assert from 'uvu/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.is(found.title, icon.title);
|
|
assert.is(found.hex, icon.hex);
|
|
assert.is(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.type(icon, 'object');
|
|
}
|
|
});
|
|
|
|
test.run();
|
|
|
|
exec();
|
|
})();
|