-
-
Notifications
You must be signed in to change notification settings - Fork 77
feat: expand Governance Page to audit repository community files checklist #185
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
Open
AbiramiR-27
wants to merge
3
commits into
AOSSIE-Org:main
Choose a base branch
from
AbiramiR-27:feat/governance-community-files
base: main
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.
+239
−15
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
254d484
feat: expand Governance Page to audit repository community files chec…
AbiramiR-27 2342a99
refactor: address CodeRabbit review recommendations by mapping full o…
AbiramiR-27 2e66bfb
fix: resolve template false negatives by querying template directorie…
AbiramiR-27 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| import React from 'react' | ||
| import { render, screen, fireEvent } from '@testing-library/react' | ||
| import { vi, describe, it, expect } from 'vitest' | ||
| import GovernancePage from './GovernancePage' | ||
|
|
||
| vi.mock('../context/AppContext', () => ({ | ||
| useApp: () => ({ | ||
| model: { | ||
| allRepos: [ | ||
| { id: 1, name: 'repo-1', orgLogin: 'AOSSIE-Org', license: null }, | ||
| { id: 2, name: 'repo-2', orgLogin: 'AOSSIE-Org', license: null } | ||
| ] | ||
| }, | ||
| issuesData: {}, | ||
| communityData: { | ||
| 'AOSSIE-Org/repo-1': { | ||
| files: { | ||
| code_of_conduct: { html_url: 'https://github.com/AOSSIE-Org/repo-1/blob/main/CODE_OF_CONDUCT.md' }, | ||
| contributing: null, | ||
| issue_template: null, | ||
| pull_request_template: null | ||
| } | ||
| }, | ||
| 'AOSSIE-Org/repo-2': { | ||
| error: true | ||
| } | ||
| }, | ||
| runAudit: vi.fn(), | ||
| govLoading: false, | ||
| auditComplete: true, | ||
| loading: false, | ||
| runGovernanceAnalysis: vi.fn(), | ||
| staleRepoStats: [] | ||
| }) | ||
| })) | ||
|
|
||
| describe('GovernancePage - Community Files tab', () => { | ||
| it('correctly calculates non-compliant community repos count and renders checklist table with fail fallback status', () => { | ||
| render(<GovernancePage />) | ||
|
|
||
| // Verify Community Files tab button displays with non-compliant count (1) | ||
| // repo-1 is missing files (1 non-compliant). repo-2 is an error, so it's excluded from calculation. | ||
| const communityTabButton = screen.getByRole('button', { name: /Community Files\s+1/i }) | ||
| expect(communityTabButton).toBeInTheDocument() | ||
|
|
||
| // Click the Community Files tab | ||
| fireEvent.click(communityTabButton) | ||
|
|
||
| // Verify the table headers render correctly | ||
| expect(screen.getByText('CODE OF CONDUCT')).toBeInTheDocument() | ||
| expect(screen.getByText('CONTRIBUTING')).toBeInTheDocument() | ||
| expect(screen.getByText('ISSUE TEMPLATES')).toBeInTheDocument() | ||
| expect(screen.getByText('PR TEMPLATES')).toBeInTheDocument() | ||
|
|
||
| // Verify repository names are rendered | ||
| expect(screen.getAllByText('repo-1').length).toBeGreaterThan(0) | ||
| expect(screen.getAllByText('repo-2').length).toBeGreaterThan(0) | ||
|
|
||
| // Verify repo-1 Code of Conduct has a green check mark linking to GitHub | ||
| const cocLink = screen.getByRole('link', { name: /✓ Yes/i }) | ||
| expect(cocLink).toBeInTheDocument() | ||
| expect(cocLink.getAttribute('href')).toBe('https://github.com/AOSSIE-Org/repo-1/blob/main/CODE_OF_CONDUCT.md') | ||
|
|
||
| // Verify repo-1 missing files show red cross marks (3 of them) | ||
| const missingElements = screen.getAllByText(/✗ Missing/i) | ||
| expect(missingElements.length).toBe(3) | ||
|
|
||
| // Verify repo-2 displays "Unable to assess" status (4 of them) | ||
| const errorElements = screen.getAllByText(/Unable to assess/i) | ||
| expect(errorElements.length).toBe(4) | ||
| }) | ||
| }) |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.