mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Fixed wrong source-map: 'inline' encoding after 1.3.0
This commit is contained in:
@@ -89,7 +89,7 @@ describe('ObfuscatedCode', () => {
|
||||
});
|
||||
|
||||
describe('source map is set, source map mode is `inline`', () => {
|
||||
const regExp: RegExp = /data:application\/json;base64/;
|
||||
const regExp: RegExp = /data:application\/json;base64,dGVzdA==/;
|
||||
|
||||
before(() => {
|
||||
obfuscatedCode = getObfuscatedCode(
|
||||
|
||||
@@ -22,7 +22,7 @@ describe('CryptUtils', () => {
|
||||
});
|
||||
|
||||
describe('btoa', () => {
|
||||
const expectedString: string = swapLettersCase('c3RyaW5n');
|
||||
const expectedString: string = swapLettersCase('C3rYAw5N');
|
||||
|
||||
let string: string;
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import 'reflect-metadata';
|
||||
|
||||
import { assert } from 'chai';
|
||||
|
||||
import { ServiceIdentifiers } from '../../../src/container/ServiceIdentifiers';
|
||||
|
||||
import { ICryptUtilsSwappedAlphabet } from '../../../src/interfaces/utils/ICryptUtilsSwappedAlphabet';
|
||||
import { IInversifyContainerFacade } from '../../../src/interfaces/container/IInversifyContainerFacade';
|
||||
|
||||
import { InversifyContainerFacade } from '../../../src/container/InversifyContainerFacade';
|
||||
|
||||
import { swapLettersCase } from '../../helpers/swapLettersCase';
|
||||
|
||||
describe('CryptUtilsSwappedAlphabet', () => {
|
||||
let cryptUtilsSwappedAlphabet: ICryptUtilsSwappedAlphabet;
|
||||
|
||||
before(() => {
|
||||
const inversifyContainerFacade: IInversifyContainerFacade = new InversifyContainerFacade();
|
||||
|
||||
inversifyContainerFacade.load('', '', {});
|
||||
cryptUtilsSwappedAlphabet = inversifyContainerFacade
|
||||
.get<ICryptUtilsSwappedAlphabet>(ServiceIdentifiers.ICryptUtilsSwappedAlphabet);
|
||||
});
|
||||
|
||||
describe('btoa', () => {
|
||||
const expectedString: string = swapLettersCase('c3RyaW5n');
|
||||
|
||||
let string: string;
|
||||
|
||||
before(() => {
|
||||
string = cryptUtilsSwappedAlphabet.btoa('string');
|
||||
});
|
||||
|
||||
it('should create a base-64 encoded string with swapped alphabet from a given string', () => {
|
||||
assert.equal(string, expectedString);
|
||||
});
|
||||
});
|
||||
|
||||
describe('rc4', () => {
|
||||
const string: string = 'test';
|
||||
const key: string = 'key';
|
||||
|
||||
let encodedString: string,
|
||||
decodedString: string;
|
||||
|
||||
before(() => {
|
||||
encodedString = cryptUtilsSwappedAlphabet.rc4(string, key);
|
||||
decodedString = cryptUtilsSwappedAlphabet.rc4(encodedString, key);
|
||||
});
|
||||
|
||||
it('should encode string using the rc4 algorithm', () => {
|
||||
assert.notEqual(encodedString, string);
|
||||
});
|
||||
|
||||
it('should encode and successfully decode string using the rc4 algorithm', () => {
|
||||
assert.equal(decodedString, string);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user