deep-linking.spec.js 1.5KB

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var path_1 = require("path");
  4. var deepLinking = require("./deep-linking");
  5. var deeplinkUtils = require("./deep-linking/util");
  6. var file_cache_1 = require("./util/file-cache");
  7. var helpers = require("./util/helpers");
  8. describe('Deep Linking task', function () {
  9. describe('deepLinkingWorkerImpl', function () {
  10. it('should not update app ngmodule when it has an existing deeplink config', function () {
  11. var appNgModulePath = path_1.join('some', 'fake', 'path', 'myApp', 'src', 'app', 'app.module.ts');
  12. var context = {
  13. fileCache: new file_cache_1.FileCache()
  14. };
  15. var knownFileContent = 'someFileContent';
  16. var knownDeepLinkString = 'someDeepLinkString';
  17. context.fileCache.set(appNgModulePath, { path: appNgModulePath, content: knownFileContent });
  18. spyOn(helpers, helpers.getStringPropertyValue.name).and.returnValue(appNgModulePath);
  19. spyOn(helpers, helpers.readAndCacheFile.name).and.returnValue(Promise.resolve(knownFileContent));
  20. spyOn(deeplinkUtils, deeplinkUtils.hasExistingDeepLinkConfig.name).and.returnValue(true);
  21. var promise = deepLinking.deepLinkingWorkerImpl(context, null);
  22. return promise.then(function (results) {
  23. expect(deeplinkUtils.hasExistingDeepLinkConfig).toHaveBeenCalled();
  24. expect(results.size).toEqual(0);
  25. });
  26. });
  27. });
  28. });