File tree Expand file tree Collapse file tree
functional-tests/node-obfuscators Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { IObfuscationResult } from "../../../src/interfaces/IObfuscationResult" ;
2+
3+ import { NO_CUSTOM_NODES_PRESET } from "../../../src/preset-options/NoCustomNodesPreset" ;
4+
5+ import { JavaScriptObfuscator } from "../../../src/JavaScriptObfuscator" ;
6+
7+ const assert : Chai . AssertStatic = require ( 'chai' ) . assert ;
8+
9+ describe ( 'ObjectExpressionObfuscator' , ( ) => {
10+ it ( 'should replace object expression node `key` property with literal value by unicode value' , ( ) => {
11+ let obfuscationResult : IObfuscationResult = JavaScriptObfuscator . obfuscate (
12+ `var test = { 'foo': 0 };` ,
13+ Object . assign ( { } , NO_CUSTOM_NODES_PRESET )
14+ ) ;
15+
16+ assert . match ( obfuscationResult . getObfuscatedCode ( ) , / ^ v a r * t e s t * = * \{ ' \\ x 6 6 \\ x 6 f \\ x 6 f ' : 0 x 0 \} ; $ / ) ;
17+ } ) ;
18+
19+ it ( 'should replace object expression node `key` property with identifier value by unicode value' , ( ) => {
20+ let obfuscationResult : IObfuscationResult = JavaScriptObfuscator . obfuscate (
21+ `var test = { foo: 0 };` ,
22+ Object . assign ( { } , NO_CUSTOM_NODES_PRESET )
23+ ) ;
24+
25+ assert . match ( obfuscationResult . getObfuscatedCode ( ) , / ^ v a r * t e s t * = * \{ ' \\ x 6 6 \\ x 6 f \\ x 6 f ' : 0 x 0 \} ; $ / ) ;
26+ } ) ;
27+ } ) ;
Original file line number Diff line number Diff line change @@ -26,3 +26,4 @@ import './functional-tests/JavaScriptObfuscatorInternal.spec';
2626import './functional-tests/node-obfuscators/LiteralObfuscator.spec' ;
2727import './functional-tests/node-obfuscators/MemberExpressionObfuscator.spec' ;
2828import './functional-tests/node-obfuscators/MethodDefinitionObfuscator.spec' ;
29+ import './functional-tests/node-obfuscators/ObjectExpressionObfuscator.spec' ;
You can’t perform that action at this time.
0 commit comments