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', () => { ...@@ -58,8 +58,8 @@ describe('Security Dashboard Action Buttons', () => {
expect(findMoreInfoButton().exists()).toBe(true); expect(findMoreInfoButton().exists()).toBe(true);
}); });
it('should emit an `setModalData` event and open the modal when clicked', () => { it('should emit an `setModalData` event and open the modal when clicked', async () => {
findMoreInfoButton().trigger('click'); await findMoreInfoButton().trigger('click');
expect(wrapper.vm.$store.dispatch).toHaveBeenCalledWith('vulnerabilities/setModalData', { expect(wrapper.vm.$store.dispatch).toHaveBeenCalledWith('vulnerabilities/setModalData', {
vulnerability: mockDataVulnerabilities[0], vulnerability: mockDataVulnerabilities[0],
...@@ -79,8 +79,8 @@ describe('Security Dashboard Action Buttons', () => { ...@@ -79,8 +79,8 @@ describe('Security Dashboard Action Buttons', () => {
expect(findCreateIssueButton().attributes('title')).toBe(i18n.createIssue); expect(findCreateIssueButton().attributes('title')).toBe(i18n.createIssue);
}); });
it('should emit an `createIssue` event when clicked', () => { it('should emit an `createIssue` event when clicked', async () => {
findCreateIssueButton().trigger('click'); await findCreateIssueButton().trigger('click');
expect(wrapper.vm.$store.dispatch).toHaveBeenCalledWith('vulnerabilities/createIssue', { expect(wrapper.vm.$store.dispatch).toHaveBeenCalledWith('vulnerabilities/createIssue', {
vulnerability: mockDataVulnerabilities[0], vulnerability: mockDataVulnerabilities[0],
...@@ -105,11 +105,11 @@ describe('Security Dashboard Action Buttons', () => { ...@@ -105,11 +105,11 @@ describe('Security Dashboard Action Buttons', () => {
expect(findCreateIssueButton().attributes('title')).toBe(i18n.createJiraIssue); 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(); jest.spyOn(window, 'open').mockReturnValueOnce();
expect(window.open).not.toHaveBeenCalled(); expect(window.open).not.toHaveBeenCalled();
findCreateIssueButton().trigger('click'); await findCreateIssueButton().trigger('click');
expect(window.open).toHaveBeenCalledWith( expect(window.open).toHaveBeenCalledWith(
mockDataVulnerabilities[8].create_jira_issue_url, mockDataVulnerabilities[8].create_jira_issue_url,
...@@ -124,8 +124,8 @@ describe('Security Dashboard Action Buttons', () => { ...@@ -124,8 +124,8 @@ describe('Security Dashboard Action Buttons', () => {
expect(findDismissVulnerabilityButton().exists()).toBe(true); expect(findDismissVulnerabilityButton().exists()).toBe(true);
}); });
it('should emit an `dismissVulnerability` event when clicked', () => { it('should emit an `dismissVulnerability` event when clicked', async () => {
findDismissVulnerabilityButton().trigger('click'); await findDismissVulnerabilityButton().trigger('click');
expect(wrapper.vm.$store.dispatch).toHaveBeenCalledWith( expect(wrapper.vm.$store.dispatch).toHaveBeenCalledWith(
'vulnerabilities/dismissVulnerability', '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