fixed a front unit test with jest.fn() as spy

This commit is contained in:
Carlos Jimenez Ruiz 2020-05-27 14:54:29 +02:00
parent dfa74221dd
commit 296967ab4b
1 changed files with 6 additions and 2 deletions

View File

@ -66,8 +66,12 @@ describe('Ticket', () => {
describe('onAddThermographClick()', () => {
it('should call the show() function of the create thermograph dialog', () => {
controller.$.newThermographDialog = {show: () => {}};
jest.spyOn(controller.$.newThermographDialog, 'show');
controller.$.newThermographDialog = {show: jest.fn()};
controller.$.modelsModel = {refresh: jest.fn()};
controller.$.temperaturesModel = {refresh: jest.fn()};
// jest.spyOn(controller.$.newThermographDialog, 'show');
// jest.spyOn(controller.$.modelsModel, 'refresh');
// jest.spyOn(controller.$.temperaturesModel, 'refresh');
const event = new Event('click');
jest.spyOn(event, 'preventDefault');