Fixed wrong source-map: 'inline' encoding after 1.3.0

This commit is contained in:
sanex3339
2020-07-10 16:31:12 +03:00
parent 514e34bbd5
commit c6887464c4
20 changed files with 154 additions and 37 deletions
@@ -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(
+1 -1
View File
@@ -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);
});
});
});