From fab1ef6d456ba3180dae7edce530ba5eb7b8fba8 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Fri, 14 Mar 2025 13:56:48 -0700 Subject: [PATCH] jest --- tests/javascripts/preventDuplicateFormSubmissions.test.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/javascripts/preventDuplicateFormSubmissions.test.js b/tests/javascripts/preventDuplicateFormSubmissions.test.js index 09c63187d..09ec7e5d2 100644 --- a/tests/javascripts/preventDuplicateFormSubmissions.test.js +++ b/tests/javascripts/preventDuplicateFormSubmissions.test.js @@ -44,17 +44,20 @@ describe('Prevent duplicate form submissions', () => { }); - test("It should prevent the second click on the 'submit' button", () => { + test("It should prevent any clicks of the 'submit' button after the first one submitting the form", () => { + helpers.triggerEvent(button, 'click'); helpers.triggerEvent(button, 'click'); + expect(formEventSpy.mock.calls.length).toEqual(1); + }); test("It should allow clicks again after 1.5 seconds", () => { helpers.triggerEvent(button, 'click'); - jest.advanceTimersByTime(10000); + jest.advanceTimersByTime(1500); helpers.triggerEvent(button, 'click');