Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/okikio/utils.
Something went wrong. Try again.
1234567891011121314151617181920212223import { describe, it } from 'node:test'import { expect } from '@std/expect'import * as fc from 'fast-check'
import * as csv from './mod.ts'
describe('CSV headers', () => { it('normalizes Unicode, punctuation, case, and whitespace deterministically', () => { expect(csv.normalizeHeader('\ufeff Company:Website_URL ')).toEqual('company website url') expect(csv.normalizeHeader('Person—Email (Work)')).toEqual('person-email work') })
it('is idempotent for arbitrary strings', () => { fc.assert(fc.property(fc.string(), (value) => { expect(csv.normalizeHeader(csv.normalizeHeader(value))).toEqual(csv.normalizeHeader(value)) }), { numRuns: 500 }) })
it('rejects non-string values instead of coercing them', () => { expect(() => csv.normalizeHeader({ toString: () => 'header' } as never)).toThrow(TypeError) })})