index.spec.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. /**
  3. * Use of this source code is governed by an MIT-style license that can be
  4. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  5. */
  6. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  7. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  8. return new (P || (P = Promise))(function (resolve, reject) {
  9. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  10. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  11. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  12. step((generator = generator.apply(thisArg, _arguments || [])).next());
  13. });
  14. };
  15. Object.defineProperty(exports, "__esModule", { value: true });
  16. const testing_1 = require("@angular-devkit/schematics/testing");
  17. const test_app_1 = require("../../testing/test-app");
  18. describe('ng-component schematic', () => {
  19. const defaultOptions = {
  20. project: 'ng-zorro',
  21. };
  22. let runner;
  23. let appTree;
  24. beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
  25. runner = new testing_1.SchematicTestRunner('schematics', require.resolve('../../collection.json'));
  26. appTree = yield (0, test_app_1.createTestApp)(runner);
  27. }));
  28. it('should update app.component.html', () => __awaiter(void 0, void 0, void 0, function* () {
  29. const options = Object.assign({}, defaultOptions);
  30. const appComponentHTMLPath = '/projects/ng-zorro/src/app/app.component.html';
  31. const tree = yield runner.runSchematic('blank', options, appTree);
  32. const appComponentHTML = tree.readContent(appComponentHTMLPath);
  33. const files = tree.files;
  34. expect(files).toEqual(jasmine.arrayContaining([appComponentHTMLPath]));
  35. expect(appComponentHTML).toContain('href="https://github.com/NG-ZORRO/ng-zorro-antd"');
  36. }));
  37. });
  38. //# sourceMappingURL=index.spec.js.map