Skip to content

Commit 2912804

Browse files
author
Diabeu
committed
chore: add emit tests
1 parent 6168ff5 commit 2912804

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/ngx-core-common.dynamic-component.class.spec.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,26 @@ describe('TestComponent', () => {
7676
}));
7777
it('_component instance subscribe to event EventEmitter', async(() => {
7878
comp.create(DynamicComponent);
79-
comp.subscribe('event', (result: any) => {
80-
expect(result).toBe('event');
81-
})
79+
comp.subscribe('event',
80+
(generatorOrNext: any) => {
81+
expect(generatorOrNext).toBe('event');
82+
},
83+
(error: any) => { },
84+
(complete: any) => { }
85+
);
8286
comp.component().instance.emit();
8387
}));
88+
it('_component instance subscribe to event EventEmitter and emit complete', async(() => {
89+
comp.create(DynamicComponent);
90+
comp.subscribe('event',
91+
(result: any) => { },
92+
(error: any) => { },
93+
(complete: any) => {
94+
console.info(`complete`);
95+
}
96+
);
97+
comp.component().instance.emitComplete();
98+
}));
8499
it('this._component should be destroyed', async(() => {
85100
comp.create(DynamicComponent);
86101
comp.destroy();

0 commit comments

Comments
 (0)