options validation with Joi tests update

This commit is contained in:
sanex3339
2016-07-13 13:58:11 +03:00
parent d26d55e314
commit 821b7d06bb
2 changed files with 18 additions and 3 deletions
+1 -2
View File
@@ -60,8 +60,7 @@ let obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
`,
{
disableConsoleOutput: false,
encodeUnicodeLiterals: true,
unicodeArrayThreshold: 2
encodeUnicodeLiterals: true
}
).getObfuscatedCode();
+17 -1
View File
@@ -8,7 +8,8 @@ const assert: Chai.AssertStatic = require('chai').assert;
describe('OptionsNormalizer', () => {
describe('normalizeOptions (options: IObfuscatorOptions): IObfuscatorOptions', () => {
let optionsPreset1: IObfuscatorOptions;
let optionsPreset1: IObfuscatorOptions,
optionsPreset2: IObfuscatorOptions;
beforeEach(() => {
optionsPreset1 = Object.assign({}, DEFAULT_PRESET, {
@@ -18,6 +19,12 @@ describe('OptionsNormalizer', () => {
unicodeArrayThreshold: 0.5,
wrapUnicodeArrayCalls: true
});
optionsPreset2 = Object.assign({}, DEFAULT_PRESET, {
rotateUnicodeArray: true,
unicodeArray: true,
unicodeArrayThreshold: 0,
wrapUnicodeArrayCalls: true
});
});
it('should normalize options preset', () => {
@@ -30,6 +37,15 @@ describe('OptionsNormalizer', () => {
wrapUnicodeArrayCalls: false
})
);
assert.deepEqual(
OptionsNormalizer.normalizeOptions(optionsPreset2), Object.assign({}, DEFAULT_PRESET, {
rotateUnicodeArray: false,
unicodeArray: false,
unicodeArrayThreshold: 0,
wrapUnicodeArrayCalls: false
})
);
});
});
});