SourceCode.spec.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import 'reflect-metadata';
  2. import { assert } from 'chai';
  3. import { SourceCode } from '../../../src/source-code/SourceCode';
  4. describe('SourceCode', () => {
  5. describe('getSourceCode', () => {
  6. describe('should return source code', () => {
  7. const expectedSourceCode: string = 'var test = 1;';
  8. let sourceCode: string;
  9. before(() => {
  10. sourceCode = new SourceCode(expectedSourceCode, 'test').getSourceCode();
  11. });
  12. it('should return source code', () => {
  13. assert.equal(sourceCode, expectedSourceCode);
  14. });
  15. });
  16. });
  17. describe('getSourceMap', () => {
  18. describe('should return source map', () => {
  19. const expectedSourceMap: string = 'test';
  20. let sourceMap: string;
  21. before(() => {
  22. sourceMap = new SourceCode('var test = 1;', expectedSourceMap).getSourceMap();
  23. });
  24. it('should return source map', () => {
  25. assert.equal(sourceMap, expectedSourceMap);
  26. });
  27. });
  28. });
  29. });