Created
March 11, 2023 15:57
-
-
Save edezekiel/4b4865cba619e20c86a399e91fbff98c to your computer and use it in GitHub Desktop.
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