Created
March 11, 2023 15:57
Mock service provided to component using constructor-based DI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DemoService } from '../demo.service'; | |
import { DemoComponent } from './demo.component'; | |
describe('DemoComponent', () => { | |
it('should create', () => { | |
const serviceMock = { getWidgets: jest.fn() }; | |
const component = new DemoComponent(serviceMock as DemoService); | |
expect(component).toBeTruthy(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment