2
0
mirror of https://github.com/iconify/collections-json.git synced 2024-11-25 06:07:39 +00:00

test: add some test for lookupCollection and lookupCollections

This commit is contained in:
Joaquín Sánchez Jiménez 2021-09-18 01:27:30 +02:00
parent 8754f02c92
commit dd6cd14f14
2 changed files with 31 additions and 6 deletions

View File

@ -0,0 +1,27 @@
import { IconifyMetaDataCollection, lookupCollection, lookupCollections } from '../dist'
let collections: IconifyMetaDataCollection
describe('lookupCollection and lookupCollections', () => {
beforeAll(() => {
return lookupCollections().then((c) => {
collections = c
return Promise.resolve(c)
})
})
test('lookupCollections has data', () => {
expect(collections ? Object.keys(collections).length : 0).toBeGreaterThan(0)
})
test('mdi collection has prefix mdi', async() => {
const collection = await lookupCollection('mdi')
expect(collection.prefix).toBe('mdi')
})
test('websymbol collection has prefix websymbol', async() => {
const collection = await lookupCollection('websymbol')
expect(collection.prefix).toBe('websymbol')
})
test('fa collection has prefix fa', async() => {
const collection = await lookupCollection('fa')
expect(collection.prefix).toBe('fa')
})
})

View File

@ -3,10 +3,8 @@ import { locate } from '../dist'
const cwd = process.cwd()
describe('locate', () => {
test('mdi resolves the json collection', () => {
const received = locate('mdi') as string
const expected = resolve(cwd, 'json', 'mdi.json').replace(/\\/g, '/')
expect(received).toBe(expected)
})
test('mdi resolves the json collection', () => {
const received = locate('mdi') as string
const expected = resolve(cwd, 'json', 'mdi.json').replace(/\\/g, '/')
expect(received).toBe(expected)
})