test: tsify internal-spec (#19962)

This commit is contained in:
Jeremy Apthorp 2019-08-28 13:54:42 -07:00 committed by GitHub
parent 217ed9aabc
commit 41d8247ffc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,12 +1,11 @@
const chai = require('chai') import { expect } from 'chai'
const { expect } = chai
describe('feature-string parsing', () => { describe('feature-string parsing', () => {
it('is indifferent to whitespace around keys and values', () => { it('is indifferent to whitespace around keys and values', () => {
const parseFeaturesString = require('../lib/common/parse-features-string') const parseFeaturesString = require('../lib/common/parse-features-string')
const checkParse = (string, parsed) => { const checkParse = (string: string, parsed: Record<string, string | boolean>) => {
const features = {} const features: Record<string, string | boolean> = {}
parseFeaturesString(string, (k, v) => { features[k] = v }) parseFeaturesString(string, (k: string, v: any) => { features[k] = v })
expect(features).to.deep.equal(parsed) expect(features).to.deep.equal(parsed)
} }
checkParse('a=yes,c=d', { a: true, c: 'd' }) checkParse('a=yes,c=d', { a: true, c: 'd' })