From f77c02af8d2452f03b009444f832d92bd3e68bb0 Mon Sep 17 00:00:00 2001 From: sanex3339 Date: Thu, 16 Jun 2016 16:16:22 +0300 Subject: [PATCH] utils tests --- test/OptionsNormalizer.spec.ts | 42 +++++++++++++++++++++++++++ test/{utils.spec.ts => Utils.spec.ts} | 0 2 files changed, 42 insertions(+) create mode 100644 test/OptionsNormalizer.spec.ts rename test/{utils.spec.ts => Utils.spec.ts} (100%) diff --git a/test/OptionsNormalizer.spec.ts b/test/OptionsNormalizer.spec.ts new file mode 100644 index 00000000..e48f7058 --- /dev/null +++ b/test/OptionsNormalizer.spec.ts @@ -0,0 +1,42 @@ +import { IOptionsPreset } from "../src/interfaces/IOptionsPreset"; + +import { OptionsNormalizer } from '../src/OptionsNormalizer'; + +import { DEFAULT_PRESET } from '../src/preset-options/DefaultPreset'; + +let assert: any = require('chai').assert; + +describe('OptionsNormalizer', () => { + describe('normalizeOptionsPreset (options: IOptionsPreset): IOptionsPreset', () => { + let optionsPreset1: IOptionsPreset = Object.assign({}, DEFAULT_PRESET, { + compact: false, + rotateUnicodeArray: true, + unicodeArray: false, + unicodeArrayThreshold: 0.5, + wrapUnicodeArrayCalls: true + + }), + optionsPreset2: IOptionsPreset = 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 + }) + ); + }); + }); +}); \ No newline at end of file diff --git a/test/utils.spec.ts b/test/Utils.spec.ts similarity index 100% rename from test/utils.spec.ts rename to test/Utils.spec.ts