File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
packages/core/schematics/utils/tsurge/test Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -67,4 +67,40 @@ describe('output migration', () => {
6767
6868 expect ( fs . readFile ( absoluteFrom ( '/app.component.ts' ) ) ) . not . toContain ( 'TODO' ) ;
6969 } ) ;
70+
71+ it ( 'should compute statistics' , async ( ) => {
72+ const migration = new OutputMigration ( ) ;
73+ const { getStatistics} = await runTsurgeMigration ( migration , [
74+ {
75+ name : absoluteFrom ( '/app.component.ts' ) ,
76+ isProgramRootFile : true ,
77+ contents : `
78+ import {Output, Component, EventEmitter} from '@angular/core';
79+
80+ @Component()
81+ export class AppComponent {
82+ @Output() clicked = new EventEmitter<void>();
83+ @Output() canBeMigrated = new EventEmitter<void>();
84+ }
85+ ` ,
86+ } ,
87+ {
88+ name : absoluteFrom ( '/other.component.ts' ) ,
89+ isProgramRootFile : true ,
90+ contents : `
91+ import {AppComponent} from './app.component';
92+
93+ const cmp: AppComponent = null!;
94+ cmp.clicked.pipe().subscribe();
95+ ` ,
96+ } ,
97+ ] ) ;
98+
99+ expect ( await getStatistics ( ) ) . toEqual ( {
100+ counters : {
101+ allOutputs : 2 ,
102+ migratedOutputs : 1 ,
103+ } ,
104+ } ) ;
105+ } ) ;
70106} ) ;
You can’t perform that action at this time.
0 commit comments