test(views): ScoreScreen

pull/12/head
sundowndev 2019-12-07 19:24:57 +01:00
parent 1b20f60b3d
commit e2f485b381
1 changed files with 9 additions and 5 deletions

View File

@ -29,14 +29,18 @@ const mountIt = (index = 0, score = 0, questions = []) => {
};
describe('Views - ScoreScreen', () => {
it('should redirect to home on index 0', () => {
mountIt();
beforeEach(() => {
jest.resetAllMocks();
jest.restoreAllMocks();
});
it('should redirect to home on index 0', () => {
const routerMock = spyOn(router, 'push');
// Errored :(
// expect(routerMock).toBeCalledTimes(1);
// expect(routerMock).toBeCalledWith({ name: 'home' });
mountIt();
expect(routerMock).toBeCalledTimes(1);
expect(routerMock).toBeCalledWith({ name: 'home' });
});
it('should not redirect to home', () => {