Skip to content

Conversation

@sherwinski
Copy link
Contributor

@sherwinski sherwinski commented Nov 27, 2025

Description

1 Line Summary

Adds more tests to increase code coverage.

Details

Adds/expands test across the following modules:

  • Bell
  • PromptsManager
  • CustomLinkManager
  • ServiceWorkerManager
  • UpdateManager
  • SessionManager

Before

 Test Files  52 passed (52)
      Tests  395 passed (395)
   Start at  19:08:24
   Duration  24.31s

 % Coverage report from v8

=============================== Coverage summary ===============================
Statements   : 67.52% ( 3817/5653 )
Branches     : 54.86% ( 1619/2951 )
Functions    : 75.44% ( 925/1226 )
Lines        : 67.69% ( 3697/5461 )
================================================================================

After

 Test Files  55 passed (55)
      Tests  411 passed (411)
   Start at  11:22:18
   Duration  32.88s

 % Coverage report from v8

=============================== Coverage summary ===============================
Statements   : 71.23% ( 4027/5653 )
Branches     : 59.26% ( 1749/2951 )
Functions    : 77.07% ( 945/1226 )
Lines        : 71.47% ( 3903/5461 )
================================================================================

Systems Affected

  • WebSDK
  • Backend
  • Dashboard

Validation

Tests

Info

Checklist

  • All the automated tests pass or I explained why that is not possible
  • I have personally tested this on my machine or explained why that is not possible
  • I have included test coverage for these changes or explained why they are not needed

Programming Checklist
Interfaces:

  • Don't use default export
  • New interfaces are in model files

Functions:

  • Don't use default export
  • All function signatures have return types
  • Helpers should not access any data but rather be given the data to operate on.

Typescript:

  • No Typescript warnings
  • Avoid silencing null/undefined warnings with the exclamation point

Other:

  • Iteration: refrain from using elem of array syntax. Prefer forEach or use map
  • Avoid using global OneSignal accessor for context if possible. Instead, we can pass it to function/constructor so that we don't call OneSignal.context

Screenshots

Info

Checklist

  • I have included screenshots/recordings of the intended results or explained why they are not needed

Related Tickets



This change is Reviewable

- disabled config and stylesheet failure return
- hiding containers when subscribed and `unsubscribeEnable: false`
- injecting markup and click flow (optIn then optOut) with text and class checks
- Different cases where `_getActiveState` returns None, OneSignal, or Third-Party sw
- `_haveParamsChanged` branches (no registration, scope mismatch, missing scriptUrl, href changes, same href)
- `_shoulInstallWorker` branches (SW support, OneSignal config, state, params changed, needs update)
- `_workerNeedsUpdate` where comparing versions
- `_sendPushDeviceRecordUpdate` early return vs triggering `sendOnSessionUpdate`
- `_sendOnSessionUpdate` branches: already sent, not first page, not registered, unsubscribed skip, subscribed path schedules upsert and sets flag
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