Skip to content

Commit

Permalink
Tests of SourceCode class
Browse files Browse the repository at this point in the history
  • Loading branch information
sanex3339 committed Oct 8, 2020
1 parent 4ff7a40 commit 5c9f5ef
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/index.spec.ts
Expand Up @@ -32,6 +32,7 @@ import './unit-tests/node/node-utils/NodeUtils.spec';
import './unit-tests/options/Options.spec';
import './unit-tests/options/ValidationErrorsFormatter.spec';
import './unit-tests/source-code/ObfuscatedCode.spec';
import './unit-tests/source-code/SourceCode.spec';
import './unit-tests/storages/ArrayStorage.spec';
import './unit-tests/storages/MapStorage.spec';
import './unit-tests/storages/string-array-transformers/literal-nodes-cache/LiteralNodesCacheStorage.spec';
Expand Down
39 changes: 39 additions & 0 deletions test/unit-tests/source-code/SourceCode.spec.ts
@@ -0,0 +1,39 @@
import 'reflect-metadata';

import { assert } from 'chai';

import { SourceCode } from '../../../src/source-code/SourceCode';

describe('SourceCode', () => {
describe('getSourceCode', () => {
describe('should return source code', () => {
const expectedSourceCode: string = 'var test = 1;';

let sourceCode: string;

before(() => {
sourceCode = new SourceCode(expectedSourceCode, 'test').getSourceCode();
});

it('should return source code', () => {
assert.equal(sourceCode, expectedSourceCode);
});
});
});

describe('getSourceMap', () => {
describe('should return source map', () => {
const expectedSourceMap: string = 'test';

let sourceMap: string;

before(() => {
sourceMap = new SourceCode('var test = 1;', expectedSourceMap).getSourceMap();
});

it('should return source map', () => {
assert.equal(sourceMap, expectedSourceMap);
});
});
});
});

0 comments on commit 5c9f5ef

Please sign in to comment.