Skip to content

Conversation

@codomposer
Copy link
Contributor

Add Test Coverage for Get Functions

Summary

Added comprehensive test coverage for getter functions in test/test.get.js, including 20 test cases covering 7 core functions.

Changes

New Test File

  • Created test/test.get.js with full browser environment mocking (window, document, XMLHttpRequest)

Functions Tested

  1. api.get.last_active() - Returns last active session info (1 test)
  2. api.get.loggedin_accounts() - Gets logged in accounts list (4 tests)
  3. api.get.user_email() - Gets current user email (3 tests)
  4. api.get.manager_email() - Gets manager/delegated email (2 tests)
  5. api.get.delegated_to_email() - Gets delegated account email (3 tests)
  6. api.get.localization() - Gets locale/language setting (5 tests)
  7. api.get.current_page() - Parses current page from URL hash (3 tests)

Technical Details

Browser Environment Mocking:

  • Mocked window, document, top, and XMLHttpRequest objects
  • Enables testing browser-dependent functions in Node.js environment
  • Uses beforeEach/afterEach hooks for clean test isolation

Contribution by Gittensor, learn more at https://gittensor.io/

@codomposer
Copy link
Contributor Author

@josteink
can you please check this pr as well?

@codomposer codomposer requested a review from josteink November 16, 2025 21:43
Copy link
Collaborator

@josteink josteink left a comment

Choose a reason for hiding this comment

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

LGTM

@josteink
Copy link
Collaborator

Thanks. Merged.

@josteink josteink merged commit e3a8c46 into KartikTalwar:master Nov 17, 2025
3 checks passed
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