test: rename & split internal module tests (#37318)

This commit is contained in:
Milan Burda 2023-02-17 10:14:40 +01:00 committed by GitHub
parent 73b7aac6a4
commit 0a5e634736
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 21 deletions

View file

@ -0,0 +1,21 @@
import { expect } from 'chai';
import { parseCommaSeparatedKeyValue } from '../lib/browser/parse-features-string';
describe('feature-string parsing', () => {
it('is indifferent to whitespace around keys and values', () => {
const checkParse = (string: string, parsed: Record<string, string | boolean>) => {
const features = parseCommaSeparatedKeyValue(string);
expect(features).to.deep.equal(parsed);
};
checkParse('a=yes,c=d', { a: true, c: 'd' });
checkParse('a=yes ,c=d', { a: true, c: 'd' });
checkParse('a=yes, c=d', { a: true, c: 'd' });
checkParse('a=yes , c=d', { a: true, c: 'd' });
checkParse(' a=yes , c=d', { a: true, c: 'd' });
checkParse(' a= yes , c=d', { a: true, c: 'd' });
checkParse(' a = yes , c=d', { a: true, c: 'd' });
checkParse(' a = yes , c =d', { a: true, c: 'd' });
checkParse(' a = yes , c = d', { a: true, c: 'd' });
checkParse(' a = yes , c = d ', { a: true, c: 'd' });
});
});