Files
javascript-obfuscator-javas…/test/functional-tests/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.spec.ts
T
sanex3339 a70f192a1c Merge branch 'domain-lock' of https://github.com/slig/javascript-obfuscator into slig-domain-lock
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.

DomainLock feature WIP
2016-09-01 18:36:03 +03:00

30 lines
1.2 KiB
TypeScript

import { IObfuscationResult } from "../../../../src/interfaces/IObfuscationResult";
import { JavaScriptObfuscator } from "../../../../src/JavaScriptObfuscator";
const assert: Chai.AssertStatic = require('chai').assert;
describe('UnicodeArrayDecodeNode', () => {
it('should correctly append `UnicodeArrayDecodeNode` custom node into the obfuscated code if `encodeUnicodeLiterals` option is set', () => {
let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
`var test = 'test';`,
{
encodeUnicodeLiterals: true
}
);
assert.match(obfuscationResult.getObfuscatedCode(), /decodeURI\(atob\(_0x([a-z0-9]){4}\[_0x([a-z0-9]){5,6}\]\)\)/);
});
it('should\'t append `UnicodeArrayDecodeNode` custom node into the obfuscated code if `encodeUnicodeLiterals` option is not set', () => {
let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
`var test = 'test';`,
{
encodeUnicodeLiterals: false
}
);
assert.notMatch(obfuscationResult.getObfuscatedCode(), /decodeURI\(atob\(_0x([a-z0-9]){4}\[_0x([a-z0-9]){5,6}\]\)\)/);
});
});