🎨 add tests & refactor

- add test for getting all tags
- add test for transforming resources
- output.json -> mockOutput.json
This commit is contained in:
Kevin Van Der Werff
2019-10-22 15:28:11 +02:00
committed by Unknown
parent 330612ea4c
commit 8273955316
4 changed files with 29 additions and 14 deletions

View File

@@ -1,4 +1,6 @@
import * as P from '../utils/pure.js'
import mockCategories from './mockCategories.json'
import mockOutput from './mockOutput.json'
test('includesElOf 1', () => {
expect(P.includesElOf([1, 2])([2])).toBeTruthy
@@ -27,3 +29,13 @@ test('partiallyIncludesElOf 2', () => {
test('partiallyIncludesElOf 3', () => {
expect(P.partiallyIncludesElOf(['aa', 'b'], ['c'])).toBeFalsy
})
test('get all tags', () => {
expect(P.getAllTags(mockCategories)).toStrictEqual([
"generator", "grid", "layout", "visual tool", "animation", "educational", "beginner", "career", "ui", "ux", "illustration", "svg", "tips", "tricks",
])
})
test('transform resources', () => {
expect(P.transformToResources(mockCategories)).toStrictEqual(mockOutput)
})