Skip to content

test(stats): add Vitest unit tests for stats plugin (fixes #71) - #325

Open
GabrielHFGoncalez wants to merge 1 commit into
outerbase:mainfrom
GabrielHFGoncalez:feature/stats-unit-tests
Open

GabrielHFGoncalez wants to merge 1 commit into
outerbase:mainfrom
GabrielHFGoncalez:feature/stats-unit-tests

Conversation

@GabrielHFGoncalez

Copy link
Copy Markdown

🧪 Vitest Unit Test Suite for plugins/stats

Contributes to #71 by adding complete Vitest unit test coverage for the plugins/stats module.

📦 Test Coverage

  • Initialization: Verifies plugin naming (starbasedb:stats), route prefix (/_internal/stats), and auth requirement (requiresAuth: true).
  • Route Registration: Validates that middleware and GET endpoint are registered with the Starbase app.
  • Authorization Guard: Verifies that non-admin or unauthorized requests receive HTTP 400 ("Unauthorized request").
  • Admin Statistics Aggregation: Tests that authenticated admin requests successfully query dataSource.rpc.getStatistics() and aggregate active plugins from registry.currentPlugins().

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.

1 participant