Skip to content

Commit

Permalink
Add test for sending the values to error reporter.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbruens committed Oct 6, 2023
1 parent 9121f74 commit c03368a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/www/views/contact_view/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,23 @@ describe('ContactView client variant', () => {
expect(supportForm).not.toBeNull();
});

it('reports correct values to error reporter on completion of support form', async () => {
const supportForm: SupportForm = el.shadowRoot!.querySelector('support-form')!;
supportForm.values.email = '[email protected]';
supportForm.values.subject = 'Test Subject';
supportForm.values.accessKeySource = 'a friend';
supportForm.values.description = 'Test Description';
supportForm.valid = true;
supportForm.dispatchEvent(new CustomEvent('submit'));
await nextFrame();

expect(mockErrorReporter.report).toHaveBeenCalledWith('Test Description', 'general', '[email protected]', {
subject: 'Test Subject',
accessKeySource: 'a friend',
isUpdatedForm: true,
});
});

it('emits success event on completion of support form', async () => {
const listener = oneEvent(el, 'success');

Expand Down

0 comments on commit c03368a

Please sign in to comment.