mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
This commit is contained in:
@@ -47,39 +47,55 @@ describe('JavaScriptObfuscator', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('empty source code', () => {
|
||||
let obfuscatedCode: string;
|
||||
describe('Empty or invalid source code', () => {
|
||||
describe('empty source code', () => {
|
||||
let obfuscatedCode: string;
|
||||
|
||||
beforeEach(() => {
|
||||
const code: string = readFileAsString(__dirname + '/fixtures/empty-input.js');
|
||||
beforeEach(() => {
|
||||
const code: string = readFileAsString(__dirname + '/fixtures/empty-input.js');
|
||||
|
||||
obfuscatedCode = JavaScriptObfuscator.obfuscate(
|
||||
code,
|
||||
).getObfuscatedCode();
|
||||
obfuscatedCode = JavaScriptObfuscator.obfuscate(
|
||||
code,
|
||||
).getObfuscatedCode();
|
||||
});
|
||||
|
||||
it('should return an empty obfuscated code', () => {
|
||||
assert.isNotOk(obfuscatedCode);
|
||||
});
|
||||
});
|
||||
|
||||
it('should return an empty obfuscated code', () => {
|
||||
assert.isNotOk(obfuscatedCode);
|
||||
});
|
||||
});
|
||||
describe('empty source code with comments', () => {
|
||||
let obfuscatedCode: string;
|
||||
|
||||
describe('empty source code with comments', () => {
|
||||
let obfuscatedCode: string;
|
||||
beforeEach(() => {
|
||||
const code: string = readFileAsString(__dirname + '/fixtures/comments-only.js');
|
||||
|
||||
beforeEach(() => {
|
||||
const code: string = readFileAsString(__dirname + '/fixtures/comments-only.js');
|
||||
obfuscatedCode = JavaScriptObfuscator.obfuscate(
|
||||
code,
|
||||
{
|
||||
controlFlowFlattening: true,
|
||||
deadCodeInjection: true
|
||||
}
|
||||
).getObfuscatedCode();
|
||||
});
|
||||
|
||||
obfuscatedCode = JavaScriptObfuscator.obfuscate(
|
||||
code,
|
||||
{
|
||||
controlFlowFlattening: true,
|
||||
deadCodeInjection: true
|
||||
}
|
||||
).getObfuscatedCode();
|
||||
it('should return an empty obfuscated code', () => {
|
||||
assert.isNotOk(obfuscatedCode);
|
||||
});
|
||||
});
|
||||
|
||||
it('should return an empty obfuscated code', () => {
|
||||
assert.isNotOk(obfuscatedCode);
|
||||
describe('invalid source code type', () => {
|
||||
let obfuscatedCode: string;
|
||||
|
||||
beforeEach(() => {
|
||||
obfuscatedCode = JavaScriptObfuscator.obfuscate(
|
||||
1 as unknown as string
|
||||
).getObfuscatedCode();
|
||||
});
|
||||
|
||||
it('should return an empty obfuscated code', () => {
|
||||
assert.isNotOk(obfuscatedCode);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user