mirror of
https://github.com/iconify/collections-json.git
synced 2024-11-08 14:21:00 +00:00
test: add some test for lookupCollection
and lookupCollections
This commit is contained in:
parent
8754f02c92
commit
dd6cd14f14
27
src/loadCollection.test.ts
Normal file
27
src/loadCollection.test.ts
Normal 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')
|
||||
})
|
||||
})
|
@ -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)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user