123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import { IOptionsPreset } from "../../src/interfaces/IOptionsPreset";
- import { OptionsNormalizer } from '../../src/OptionsNormalizer';
- import { DEFAULT_PRESET } from '../../src/preset-options/DefaultPreset';
- const assert: Chai.AssertStatic = require('chai').assert;
- describe('OptionsNormalizer', () => {
- describe('normalizeOptionsPreset (options: IOptionsPreset): IOptionsPreset', () => {
- let optionsPreset1: IOptionsPreset,
- optionsPreset2: IOptionsPreset;
- beforeEach(() => {
- optionsPreset1 = Object.assign({}, DEFAULT_PRESET, {
- compact: false,
- rotateUnicodeArray: true,
- unicodeArray: false,
- unicodeArrayThreshold: 0.5,
- wrapUnicodeArrayCalls: true
- });
- optionsPreset2 = Object.assign({}, DEFAULT_PRESET, {
- unicodeArrayThreshold: 2
- });
- });
- it('should normalize options preset', () => {
- assert.deepEqual(
- OptionsNormalizer.normalizeOptionsPreset(optionsPreset1), Object.assign({}, DEFAULT_PRESET, {
- compact: true,
- rotateUnicodeArray: false,
- unicodeArray: false,
- unicodeArrayThreshold: 0,
- wrapUnicodeArrayCalls: false
- })
- );
- assert.deepEqual(
- OptionsNormalizer.normalizeOptionsPreset(optionsPreset2), Object.assign({}, DEFAULT_PRESET, {
- unicodeArrayThreshold: 1
- })
- );
- });
- });
- });
|