Commit 81e96a66 authored by Dave Pisek's avatar Dave Pisek

Specs: use async/await for trigger calls

* `.trigger` calls are async
parent f4ffeb31
......@@ -58,8 +58,8 @@ describe('Security Dashboard Action Buttons', () => {
expect(findMoreInfoButton().exists()).toBe(true);
});
it('should emit an `setModalData` event and open the modal when clicked', () => {
findMoreInfoButton().trigger('click');
it('should emit an `setModalData` event and open the modal when clicked', async () => {
await findMoreInfoButton().trigger('click');
expect(wrapper.vm.$store.dispatch).toHaveBeenCalledWith('vulnerabilities/setModalData', {
vulnerability: mockDataVulnerabilities[0],
......@@ -79,8 +79,8 @@ describe('Security Dashboard Action Buttons', () => {
expect(findCreateIssueButton().attributes('title')).toBe(i18n.createIssue);
});
it('should emit an `createIssue` event when clicked', () => {
findCreateIssueButton().trigger('click');
it('should emit an `createIssue` event when clicked', async () => {
await findCreateIssueButton().trigger('click');
expect(wrapper.vm.$store.dispatch).toHaveBeenCalledWith('vulnerabilities/createIssue', {
vulnerability: mockDataVulnerabilities[0],
......@@ -105,11 +105,11 @@ describe('Security Dashboard Action Buttons', () => {
expect(findCreateIssueButton().attributes('title')).toBe(i18n.createJiraIssue);
});
it('should open a new window when the create-issue button is clicked', () => {
it('should open a new window when the create-issue button is clicked', async () => {
jest.spyOn(window, 'open').mockReturnValueOnce();
expect(window.open).not.toHaveBeenCalled();
findCreateIssueButton().trigger('click');
await findCreateIssueButton().trigger('click');
expect(window.open).toHaveBeenCalledWith(
mockDataVulnerabilities[8].create_jira_issue_url,
......@@ -124,8 +124,8 @@ describe('Security Dashboard Action Buttons', () => {
expect(findDismissVulnerabilityButton().exists()).toBe(true);
});
it('should emit an `dismissVulnerability` event when clicked', () => {
findDismissVulnerabilityButton().trigger('click');
it('should emit an `dismissVulnerability` event when clicked', async () => {
await findDismissVulnerabilityButton().trigger('click');
expect(wrapper.vm.$store.dispatch).toHaveBeenCalledWith(
'vulnerabilities/dismissVulnerability',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment