-
Notifications
You must be signed in to change notification settings - Fork 0
feat: seal on feed detail page #190
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
45bbac8
added mcp configs
Alessandro100 5b7e7df
creation of template seal-of-reliability page
Alessandro100 b5b6858
Seal of Reliability UI elements on feed detail page
Alessandro100 b8458a5
seal of reliability criteria
Alessandro100 2055b1d
revalidate endpoint fetch
Alessandro100 22d0aaf
language
Alessandro100 0deceb8
seal quality summary tests
Alessandro100 559966e
added seasonal feed chip
Alessandro100 2e04273
lint fix
Alessandro100 9162ece
on probation status
Alessandro100 9d7beb8
Potential fix for pull request finding
Alessandro100 6061640
correct user featrue flags
Alessandro100 504a186
correct configs and implementation
Alessandro100 7c7f921
accessibility + text
Alessandro100 d55a715
updated critera
Alessandro100 0270031
fixed e2e tests
Alessandro100 c2c995c
unit test fix
Alessandro100 c0ca9e6
seasonal feed ui placement
Alessandro100 6c12cd0
extra seasonal text
Alessandro100 063fe0a
text change
Alessandro100 504d197
grace period icon color
Alessandro100 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "mcpServers": { | ||
| "chrome-devtools": { | ||
| "command": "npx", | ||
| "args": ["-y", "chrome-devtools-mcp@latest"] | ||
| }, | ||
| "next-devtools": { | ||
| "command": "npx", | ||
| "args": ["-y", "next-devtools-mcp@latest"] | ||
| } | ||
| } | ||
| } | ||
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
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
12 changes: 12 additions & 0 deletions
12
src/app/[locale]/feeds/[feedDataType]/[feedId]/authed/seal-of-reliability/page.tsx
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,12 @@ | ||
| import FeedReliabilityView from '../../../../../../screens/Feed/components/FeedReliabilityView'; | ||
| import { type ReactElement } from 'react'; | ||
|
|
||
| /** | ||
| * Force dynamic rendering for authenticated route. | ||
| * This allows cookie() and headers() access. | ||
| */ | ||
| export const dynamic = 'force-dynamic'; | ||
|
|
||
| export default async function AuthedFeedReliabilityPage(): Promise<ReactElement> { | ||
| return <FeedReliabilityView />; | ||
| } |
91 changes: 91 additions & 0 deletions
91
src/app/[locale]/feeds/[feedDataType]/[feedId]/lib/feed-data-shared.spec.ts
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,91 @@ | ||
| /** | ||
| * @jest-environment node | ||
| */ | ||
|
|
||
| import { | ||
| fetchReliabilityData, | ||
| fetchCompleteFeedDataImpl, | ||
| } from './feed-data-shared'; | ||
|
|
||
| jest.mock('server-only', () => ({})); | ||
| jest.mock('next/cache', () => ({ | ||
| unstable_cache: (fn: unknown) => fn, | ||
| })); | ||
|
|
||
| const mockGetGtfsFeedReliability = jest.fn(); | ||
| const mockGetGtfsFeed = jest.fn(); | ||
| const mockGetGtfsFeedDatasets = jest.fn(); | ||
| const mockGetGtfsFeedRoutes = jest.fn(); | ||
|
|
||
| jest.mock('../../../../../services/feeds', () => ({ | ||
| getGtfsFeedReliability: (...args: unknown[]) => | ||
| mockGetGtfsFeedReliability(...args), | ||
| getGtfsFeed: (...args: unknown[]) => mockGetGtfsFeed(...args), | ||
| getGtfsFeedDatasets: (...args: unknown[]) => mockGetGtfsFeedDatasets(...args), | ||
| getGtfsFeedRoutes: (...args: unknown[]) => mockGetGtfsFeedRoutes(...args), | ||
| })); | ||
|
|
||
| describe('fetchReliabilityData', () => { | ||
| beforeEach(() => { | ||
| jest.clearAllMocks(); | ||
| }); | ||
|
|
||
| it('returns the reliability report on success', async () => { | ||
| const report = { feed_id: 'mdb-1', has_seal: true, criteria: [] }; | ||
| mockGetGtfsFeedReliability.mockResolvedValue(report); | ||
|
|
||
| const result = await fetchReliabilityData('mdb-1', 'token', undefined); | ||
|
|
||
| expect(result).toEqual(report); | ||
| }); | ||
|
|
||
| // unstable_cache is mocked as a pass-through here, so this exercises the | ||
| // real cached-fetcher function: it must reject (not resolve to `null`) | ||
| // on failure, or a real unstable_cache would persist the failure as a | ||
| // 14-day negative-cache entry. | ||
| it('returns undefined without throwing when the API call fails', async () => { | ||
| mockGetGtfsFeedReliability.mockRejectedValue(new Error('network error')); | ||
|
|
||
| await expect( | ||
| fetchReliabilityData('mdb-1', 'token', undefined), | ||
| ).resolves.toBeUndefined(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('fetchCompleteFeedDataImpl', () => { | ||
| beforeEach(() => { | ||
| jest.clearAllMocks(); | ||
| mockGetGtfsFeed.mockResolvedValue({ id: 'mdb-1', data_type: 'gtfs' }); | ||
| mockGetGtfsFeedDatasets.mockResolvedValue([]); | ||
| mockGetGtfsFeedRoutes.mockResolvedValue(null); | ||
| }); | ||
|
|
||
| it('does not call the reliability API when enableSealOfReliability is false', async () => { | ||
| const result = await fetchCompleteFeedDataImpl( | ||
| 'gtfs', | ||
| 'mdb-1', | ||
| 'token', | ||
| undefined, | ||
| false, | ||
| ); | ||
|
|
||
| expect(mockGetGtfsFeedReliability).not.toHaveBeenCalled(); | ||
| expect(result.reliability).toBeUndefined(); | ||
| }); | ||
|
|
||
| it('calls the reliability API when enableSealOfReliability is true', async () => { | ||
| const report = { feed_id: 'mdb-1', has_seal: true, criteria: [] }; | ||
| mockGetGtfsFeedReliability.mockResolvedValue(report); | ||
|
|
||
| const result = await fetchCompleteFeedDataImpl( | ||
| 'gtfs', | ||
| 'mdb-1', | ||
| 'token', | ||
| undefined, | ||
| true, | ||
| ); | ||
|
|
||
| expect(mockGetGtfsFeedReliability).toHaveBeenCalledTimes(1); | ||
| expect(result.reliability).toEqual(report); | ||
| }); | ||
| }); |
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.
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.