UNPKG

1.15 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const core_1 = require("@angular/core");
4const NgModulesAnalyzer_1 = require("./NgModulesAnalyzer");
5const FooComponent = (0, core_1.Component)({})(class {
6});
7const BarComponent = (0, core_1.Component)({})(class {
8});
9const BetaModule = (0, core_1.NgModule)({ declarations: [FooComponent] })(class {
10});
11const AlphaModule = (0, core_1.NgModule)({ imports: [BetaModule] })(class {
12});
13describe('isComponentAlreadyDeclaredInModules', () => {
14 it('should return true when the component is already declared in one of modules', () => {
15 expect((0, NgModulesAnalyzer_1.isComponentAlreadyDeclared)(FooComponent, [], [AlphaModule])).toEqual(true);
16 });
17 it('should return true if the component is in moduleDeclarations', () => {
18 expect((0, NgModulesAnalyzer_1.isComponentAlreadyDeclared)(BarComponent, [BarComponent], [AlphaModule])).toEqual(true);
19 });
20 it('should return false if the component is not declared', () => {
21 expect((0, NgModulesAnalyzer_1.isComponentAlreadyDeclared)(BarComponent, [], [AlphaModule])).toEqual(false);
22 });
23});