mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
# 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
30 lines
1.2 KiB
TypeScript
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}\]\)\)/);
|
|
});
|
|
});
|