transpile.spec.js 1.2KB

1234567891011121314151617181920212223
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var transpile = require("./transpile");
  4. var file_cache_1 = require("./util/file-cache");
  5. describe('transpile', function () {
  6. describe('resetSourceFiles', function () {
  7. it('should remove any files with temporary suffix, and reset content to the original, non-modified value', function () {
  8. var context = {
  9. fileCache: new file_cache_1.FileCache()
  10. };
  11. var aboutFilePath = 'about.ts';
  12. var aboutFile = { path: aboutFilePath, content: 'modifiedContent' };
  13. var originalAboutFilePath = aboutFilePath + transpile.inMemoryFileCopySuffix;
  14. var originalAboutFile = { path: originalAboutFilePath, content: 'originalContent' };
  15. context.fileCache.set(aboutFilePath, aboutFile);
  16. context.fileCache.set(originalAboutFilePath, originalAboutFile);
  17. transpile.resetSourceFiles(context.fileCache);
  18. expect(context.fileCache.get(originalAboutFilePath)).toBeFalsy();
  19. expect(context.fileCache.get(aboutFilePath).content).toEqual(originalAboutFile.content);
  20. });
  21. });
  22. });