[READ-ONLY] Mirror of https://github.com/sxzz/hanji. 一字之間,照見五地字形 hanji.sxzz.moe
chinese-characters cjk han hanja hanji hanzi kanji
Something went wrong. Try again.
12345678910111213141516171819202122232425262728import { describe, expect, it } from 'vitest'import { asRange } from '../app/composables/query-state.ts'
describe('stroke range query parsing', () => { it.each([ ['1-36', [1, 36]], ['10-10', [10, 10]], ])('accepts %s', (raw, expected) => { expect(asRange.parse(raw)).toEqual(expected) })
it.each([ // Reversed bounds would match nothing yet read as a legitimate empty table. '20-10', // A third segment would otherwise be dropped without a trace. '1-2-3', 'x-10', '10-x', // Number('') is 0, so an empty segment must be rejected before conversion. '-10', '10-', '0-', '-', ])('rejects %s so the query falls back to the default', (raw) => { expect(() => asRange.parse(raw)).toThrow() })})