Skip to content

Add unit tests for src/api/auth.rs #28

Description

@ih8js-git

Why it needs tests: It contains parsing and validation logic, like the UserInfo::name() fallback behavior. The token validation and keyring storage are also important.

How to test it:

  • The pure logic (like UserInfo) can be tested instantly.
  • Testing the network call in validate_token would require mocking the HTTP client (e.g., using the mockito or wiremock crates).
  • Testing store_token might be difficult because the keyring crate interacts directly with the OS's secret service. You'd likely only want integration tests for this, or you'd need to introduce a trait to mock the keyring behavior for unit tests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

  • Status
    Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions