-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.js
48 lines (39 loc) · 1.67 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import test from 'ava';
import icons from './';
import iconsBackup from './data/icons.json';
test('Check amount of icons for latest FA version', async (t) => {
const faIcons = await icons.getList();
t.is(faIcons.length, 675);
});
test('Check if backup and latest FA icons are the same', async (t) => {
const faIcons = await icons.getList();
t.deepEqual(faIcons, iconsBackup.icons);
});
test('Check the version of FA', async (t) => {
const faVersion = await icons.version();
t.is(faVersion, '4.7.x');
});
test('Check amount of categories', async (t) => {
const faCategories = await icons.getCategories();
t.is(faCategories.length, 16);
});
test('Check that first category is called "Web Application Icons"', async (t) => {
const faCategories = await icons.getCategories();
t.is(faCategories[0].name, 'Web Application Icons');
});
test('Check amount of icons in "Web Application Icons" category', async (t) => {
const faCategory = await icons.getIconsByCategory('Web Application Icons');
t.is(faCategory.length, 374);
});
test('Non-existing category name should return empty erray', async (t) => {
const faCategory = await icons.getIconsByCategory('Hello FA');
t.is(faCategory.length, 0);
});
test('getListByKeys should return simplified objects', async (t) => {
const faIcons = await icons.getListByKeys(['name', 'unicode']);
t.deepEqual(faIcons[0], { name: 'Glass', unicode: 'f000' });
});
test('getCategories should be able to return simplified icon objects', async (t) => {
const faCategories = await icons.getCategories(['name', 'unicode']);
t.deepEqual(faCategories[0].icons[0], { name: 'Glass', unicode: 'f000' });
});