UNPKG

1.19 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var transpile = require("./transpile");
4var file_cache_1 = require("./util/file-cache");
5describe('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});