rudder-sdk-js icon indicating copy to clipboard operation
rudder-sdk-js copied to clipboard

fix: adding unit test suite for fullstory

Open shrouti1507 opened this issue 10 months ago • 5 comments

PR Description

Please include a summary of the change along with the relevant motivation and context.

Linear task (optional)

resolves INT-895

Cross Browser Tests

Please confirm you have tested for the following browsers:

  • [ ] Chrome
  • [ ] Firefox
  • [ ] IE11

Sanity Suite

  • [ ] All sanity suite test cases pass locally

Security

  • [ ] The code changed/added as part of this pull request won't create any security issues with how the software is being used.

Summary by CodeRabbit

  • Tests
    • Enhanced testing capabilities for the Fullstory integration.
    • Improved initialization, event handling, and user identification tests.
    • Added new tests for pageview, track, and user identification events.

shrouti1507 avatar Apr 23 '24 13:04 shrouti1507

Walkthrough

Walkthrough

The changes in the Fullstory integration primarily focus on enhancing the initialization process, event handling, and user identification logic. This includes the addition of new utility functions, improved setup and teardown procedures in tests, and refined event tracking functionalities. These updates aim to make the integration more robust and the tests more comprehensive.

Changes

Files/Groups Change Summary
browser.test.js Significant updates to initialization, event handling, and user identification logic; added mocks, setup global variables, and refined tests.
.../Fullstory/nativeSdkLoader Added loadNativeSdk function.
.../Fullstory/utils Added getDestinationOptions function.
.../Fullstory/constants Added DESTINATION_ID constant.

Sequence Diagram(s)

sequenceDiagram
    participant Test as browser.test.js
    participant FullStory as FullStory Integration
    participant Utils as Utils
    participant NativeSdk as nativeSdkLoader

    Test->>FullStory: Initialize with configuration
    FullStory->>NativeSdk: Call loadNativeSdk
    NativeSdk-->>FullStory: SDK Loaded
    FullStory->>Utils: Get destination options
    Utils-->>FullStory: Destination options returned
    FullStory-->>Test: Initialization complete

    Test->>FullStory: Trigger page event
    FullStory-->>Test: Page event tracked

    Test->>FullStory: Trigger track event
    FullStory-->>Test: Track event tracked

    Test->>FullStory: Trigger identify event
    FullStory-->>Test: Identify event tracked

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Apr 23 '24 13:04 coderabbitai[bot]

size-limit report 📦

Name Size (Base) Size (Current) Size Limit Status
Common Code - No bundling 15.79 KB 15.79 KB (0%) 16.5 KB
Remote Module Federation Mapping - CDN 330 B 330 B (0%) 512 B
Remote Module Federated Plugins - CDN 5.69 KB 5.69 KB (0%) 6 KB
Core ESM - NPM 7.68 KB 7.68 KB (0%) 8 KB
Core CJS - NPM 23.74 KB 23.74 KB (0%) 24 KB
Core - NPM 23.84 KB 23.84 KB (0%) 24 KB
Core Legacy - CDN 44.59 KB 44.59 KB (0%) 45 KB
Core - CDN 24.06 KB 24.06 KB (0%) 24.5 KB
Core (legacy build) - CDN - v1.1 31.5 KB 31.5 KB (0%) 32 KB
Core - NPM - v1.1 31.52 KB 31.52 KB (0%) 32 KB
Service Worker Module 23.3 KB 23.3 KB (0%) 24 KB
All Integrations (legacy build) - CDN 99.1 KB 99.3 KB (+0.21% ▲) 105 KB

github-actions[bot] avatar Apr 23 '24 13:04 github-actions[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 55.35%. Comparing base (f62b758) to head (56ed430). Report is 121 commits behind head on develop.

:exclamation: Current head 56ed430 differs from pull request most recent head 7a4be08

Please upload reports for the commit 7a4be08 to get more accurate results.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1701      +/-   ##
===========================================
+ Coverage    54.27%   55.35%   +1.07%     
===========================================
  Files          462      465       +3     
  Lines        15655    15875     +220     
  Branches      3095     3196     +101     
===========================================
+ Hits          8497     8787     +290     
+ Misses        5898     5754     -144     
- Partials      1260     1334      +74     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 08 '24 05:05 codecov[bot]

Hello! This PR has been open for 20 days without any activity. Therefore, it's considered as stale and is scheduled to be closed in 10 days. If you're still working on this, please remove the 'Stale' label or add a comment to keep it open. Thanks for your contribution!

github-actions[bot] avatar Jul 01 '24 00:07 github-actions[bot]

Hello! This PR has been open for 20 days without any activity. Therefore, it's considered as stale and is scheduled to be closed in 10 days. If you're still working on this, please remove the 'Stale' label or add a comment to keep it open. Thanks for your contribution!

github-actions[bot] avatar Jul 25 '24 00:07 github-actions[bot]

Hello! This PR has been open for 20 days without any activity. Therefore, it's considered as stale and is scheduled to be closed in 10 days. If you're still working on this, please remove the 'Stale' label or add a comment to keep it open. Thanks for your contribution!

github-actions[bot] avatar Aug 15 '24 00:08 github-actions[bot]