Skip to content

Commit 385a8ae

Browse files
committed
Implementing test when the ngOnChanges method is the first change, the onSubmit method id not called
1 parent a686a21 commit 385a8ae

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/app/modules/reports/components/time-range-form/time-range.component.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ describe('Reports Page', () => {
133133
expect(component.onSubmit).toHaveBeenCalled();
134134
});
135135

136+
it('When the ngOnChanges method is the first change, the onSubmit method is not called', () => {
137+
const userId = 'abcd';
138+
spyOn(component, 'onSubmit');
139+
140+
component.ngOnChanges({userId: new SimpleChange(null, userId, true)});
141+
142+
expect(component.onSubmit).not.toHaveBeenCalled();
143+
});
144+
136145
afterEach(() => {
137146
fixture.destroy();
138147
});

0 commit comments

Comments
 (0)