Skip to content

Conversation

@landomen
Copy link
Contributor

@landomen landomen commented Dec 10, 2025

Task/Issue URL: https://app.asana.com/1/137249556945/project/1203581873609357/task/1212381653445208?focus=true

Description

Adds missing unit tests for the JS event handlers.

Steps to test this PR

Ensure the unit tests pass

UI changes

No UI changes


Note

Adds extensive unit tests covering PIR JS event handlers (state transitions, side effects, pixels, retries) and fixes a handler class name; also simplifies retry decision logic.

  • Tests (new, extensive):
    • BrokerActionFailedEventHandlerTest: verifies retry limits, expectation-only retries for scans, failure pixel emission.
    • BrokerStepCompletedEventHandlerTest: validates success/failure outcomes, email confirmation flow, stage timing, and state resets.
    • CaptchaInfoReceivedEventHandlerTest: asserts transaction ID handling, next-action progression, and pixel emission for opt-out.
    • EmailReceivedEventHandlerTest: ensures email propagation to ExtractedProfile, generated email state, pixel emission, and next action.
    • ErrorReceivedHandlerTest: maps various errors to BrokerActionFailed with no retry; state remains unchanged.
    • ExecuteBrokerStepActionEventHandlerTest: covers side effects (PushJsAction, LoadUrl, captcha/email flows), delays, pixels, and data sourcing.
    • ExecuteNextBrokerStepEventHandlerTest: starts next broker step, emits start pixels, resets indices, completes execution when done.
    • LoadUrlCompleteEventHandlerTest / LoadUrlFailedEventHandlerTest: handle initial/recovery URLs, advance/abort flows, and retries.
    • RetryAwaitCaptchaSolutionEventHandlerTest / RetryGetCaptchaSolutionEventHandlerTest: increment attempts and re-dispatch side effects.
    • StartedEventHandlerTest: initializes attempt ID and kicks off initial URL load.
  • Minor fixes:
    • Rename CaptchaInforReceivedEventHandler to CaptchaInfoReceivedEventHandler.
    • Simplify shouldRetryFailedAction with an expression return while preserving behavior.

Written by Cursor Bugbot for commit 55bc3fd. This will update automatically on new commits. Configure here.

Copy link
Contributor

@karlenDimla karlenDimla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

@landomen landomen merged commit f9e3a89 into develop Dec 11, 2025
13 checks passed
@landomen landomen deleted the feature/domen/pir-tests-event-handlers branch December 11, 2025 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants