-
Notifications
You must be signed in to change notification settings - Fork 0
test: add unit and integration tests for Backstage plugin #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
talissoncosta
wants to merge
9
commits into
feat/6422-ui-improvements
Choose a base branch
from
feat/6424-add-tests
base: feat/6422-ui-improvements
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,588
−0
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add a test job that runs yarn test --coverage --ci on every PR and push to main. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add shared mock data (projects, environments, features, usage data) and test utilities (renderWithBackstage, createMockFetchApi) for use across all tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add tests for getFeatureEnvStatus, buildEnvStatusTooltip, calculateFeatureStats, and paginate functions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add tests for buildFlagUrl and buildProjectUrl URL builder functions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add tests for all API client methods with mocked fetch responses and error handling. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add tests for useFlagsmithProject and useFlagsmithUsage hooks including loading states, success flows, and error handling. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add tests for shared UI components including ARIA accessibility, user interactions, and prop variations. - LoadingState: spinner, message, ARIA attributes - MiniPagination: navigation, disabled states, ARIA - FlagStatusIndicator: enabled/disabled states - FlagsmithLink: link rendering, iconOnly mode - SearchInput: input, clear button, debounce 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add integration tests for main components with mocked API responses, testing loading states, data display, error handling, and user interactions. - FlagsTab: search filtering, feature display, error states - FlagsmithOverviewCard: stats display, pagination - FlagsmithUsageCard: chart rendering, usage data 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Change button to link role for MUI IconButton with component="a" - Use more specific text matchers to avoid multiple element matches - Remove style assertions (CSS-in-JS unreliable in JSDOM) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add comprehensive unit and integration tests for the Flagsmith Backstage plugin, plus GitHub Actions CI for running tests on every PR.
Closes #6424
Changes
CI/CD
yarn test --coverage --ci)Test Infrastructure
renderWithBackstage,createMockFetchApi) for consistent test setupUnit Tests
flagHelpers.ts):getFeatureEnvStatus,buildEnvStatusTooltip,calculateFeatureStats,paginateflagsmithTheme.ts):buildFlagUrl,buildProjectUrlURL buildersFlagsmithClient.ts): All methods with mocked fetch and error handlinguseFlagsmithProject,useFlagsmithUsagewith loading/success/error statesComponent Tests
LoadingState,MiniPagination,FlagStatusIndicator,FlagsmithLink,SearchInputFlagsTab,FlagsmithOverviewCard,FlagsmithUsageCardTest Coverage
Commits
ci: add test job to GitHub Actions workflowtest: add test fixtures and utilitiestest(utils): add unit tests for flagHelperstest(theme): add unit tests for flagsmithThemetest(api): add unit tests for FlagsmithClienttest(hooks): add unit tests for custom hookstest(components): add unit tests for shared componentstest(components): add integration tests for main componentsTest Plan
🤖 Generated with Claude Code