Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use size helper in config import tests #568

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions tests/config-import.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-check
import { test } from 'brittle'
import { size } from 'iterpal'
import { readConfig } from '../src/config-import.js'

test('config import - loading', async (t) => {
Expand Down Expand Up @@ -214,30 +215,22 @@ test('config import - load default config', async (t) => {
let config = await readConfig('./config/defaultConfig.mapeoconfig')
t.ok(config, 'valid config file')

let nFields = 0
/* eslint-disable-next-line */
for (const field of config.fields()) {
nFields++
}
t.is(nFields, 2, 'correct number of fields in default config')
t.is(size(config.fields()), 2, 'correct number of fields in default config')
let nIcons = 0
let nVariants = 0
/* eslint-disable-next-line */
for await (const icon of config.icons()) {
nIcons++
/* eslint-disable-next-line */
for (let variant of icon.variants) {
nVariants++
}
nVariants += size(icon.variants)
}
t.is(nIcons, 41, 'correct number of icons in default config')
t.is(nVariants, 369, 'correct number of icon variants in default config')

let nPresets = 0
/* eslint-disable-next-line */
for (const preset of config.presets()) {
nPresets++
}
t.is(nPresets, 43, 'correct number of presets in default config')
t.is(
size(config.presets()),
43,
'correct number of presets in default config'
)

t.is(config.warnings.length, 0, 'no warnings on config file')
})
Loading