-
Notifications
You must be signed in to change notification settings - Fork 0
RIC-T40 Fixes #22
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
RIC-T40 Fixes #22
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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,32 @@ | ||
| import { spawnSync } from 'node:child_process'; | ||
| import path from 'node:path'; | ||
|
|
||
| const scriptPath = path.join(process.cwd(), 'scripts/extract-release-notes.sh'); | ||
|
|
||
| const extractReleaseNotes = (body: string): string => { | ||
| const result = spawnSync('bash', [scriptPath, '--extract-only'], { | ||
| encoding: 'utf8', | ||
| input: body, | ||
| }); | ||
|
|
||
| if (result.status !== 0) { | ||
| throw new Error(result.stderr); | ||
| } | ||
|
|
||
| return result.stdout.trim(); | ||
| }; | ||
|
|
||
| describe('extract-release-notes', () => { | ||
| it.each(['##', '###'])('normalizes a %s PR Description heading', (heading) => { | ||
| const notes = extractReleaseNotes(`${heading} PR Description\n\nAdds the release change.`); | ||
|
|
||
| expect(notes).toBe(`${heading} Description\nAdds the release change.`); | ||
| expect(notes).not.toContain('PR Description'); | ||
| }); | ||
|
|
||
| it('continues to prefer the dedicated Release Notes section', () => { | ||
| const notes = extractReleaseNotes('## PR Description\nInternal PR context\n\n## Release Notes\nUser-facing change\n\n## Testing\nPassed'); | ||
|
|
||
| expect(notes).toBe('User-facing change'); | ||
| }); | ||
| }); |
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,151 @@ | ||
| import { fireEvent, render, screen } from '@testing-library/react-native'; | ||
| import React from 'react'; | ||
|
|
||
| import { type IncidentCommandSummary } from '@/models/v4/incidentCommand/incidentCommandModels'; | ||
| import { useIncidentsStore } from '@/stores/command/incidents-store'; | ||
|
|
||
| jest.mock('@react-navigation/native', () => ({ | ||
| useFocusEffect: jest.fn(), | ||
| })); | ||
|
|
||
| jest.mock('expo-router', () => ({ | ||
| router: { push: jest.fn() }, | ||
| })); | ||
|
|
||
| jest.mock('react-i18next', () => ({ | ||
| useTranslation: () => ({ t: (key: string) => key }), | ||
| })); | ||
|
|
||
| jest.mock('@/components/ui/focus-aware-status-bar', () => ({ | ||
| FocusAwareStatusBar: () => null, | ||
| })); | ||
|
|
||
| jest.mock('@/components/command/incident-card', () => { | ||
| const React = require('react'); | ||
| const { Text } = require('react-native'); | ||
|
|
||
| return { | ||
| IncidentCard: ({ summary }: { summary: { CallName?: string | null; IncidentCommandId: string; Name?: string | null } }) => | ||
| React.createElement(Text, { testID: `incident-summary-${summary.IncidentCommandId}` }, summary.Name ?? summary.CallName), | ||
| }; | ||
| }); | ||
|
|
||
| jest.mock('@/components/common/loading', () => { | ||
| const React = require('react'); | ||
| const { Text } = require('react-native'); | ||
|
|
||
| return { | ||
| Loading: ({ text }: { text: string }) => React.createElement(Text, { testID: 'loading' }, text), | ||
| }; | ||
| }); | ||
|
|
||
| jest.mock('@/components/common/zero-state', () => { | ||
| const React = require('react'); | ||
| const { Text, View } = require('react-native'); | ||
|
|
||
| return { | ||
| __esModule: true, | ||
| default: ({ description, heading }: { description: string; heading: string }) => | ||
| React.createElement(View, { testID: 'zero-state' }, React.createElement(Text, null, heading), React.createElement(Text, null, description)), | ||
| }; | ||
| }); | ||
|
|
||
| jest.mock('@/components/ui/flat-list', () => { | ||
| const React = require('react'); | ||
| const { View } = require('react-native'); | ||
|
|
||
| return { | ||
| FlatList: ({ | ||
| data, | ||
| keyExtractor, | ||
| ListEmptyComponent, | ||
| renderItem, | ||
| testID, | ||
| }: { | ||
| data: { IncidentCommandId: string }[]; | ||
| keyExtractor: (item: { IncidentCommandId: string }) => string; | ||
| ListEmptyComponent?: unknown; | ||
| renderItem: (info: { item: { IncidentCommandId: string } }) => unknown; | ||
| testID?: string; | ||
| }) => React.createElement(View, { testID }, data.length > 0 ? data.map((item) => React.createElement(View, { key: keyExtractor(item) }, renderItem({ item }) as never)) : (ListEmptyComponent as never)), | ||
| }; | ||
| }); | ||
|
|
||
| import IncidentsScreen from '../incidents'; | ||
|
|
||
| const summaries: IncidentCommandSummary[] = [ | ||
| { | ||
| IncidentCommandId: 'ic-1', | ||
| DepartmentId: 1, | ||
| CallId: 101, | ||
| Name: 'Warehouse Fire', | ||
| CallName: 'Commercial Structure Fire', | ||
| CallNumber: 'C-1001', | ||
| CallAddress: '100 Industrial Way', | ||
| Status: 0, | ||
| EstablishedOn: '2026-07-25T10:00:00Z', | ||
| CommanderName: 'Alex Rivera', | ||
| CommandPostLocationText: 'North entrance', | ||
| AssignedPersonnelCount: 8, | ||
| AssignedUnitCount: 3, | ||
| }, | ||
| { | ||
| IncidentCommandId: 'ic-2', | ||
| DepartmentId: 1, | ||
| CallId: 202, | ||
| Name: 'Flood Response', | ||
| CallName: 'Flooding', | ||
| CallNumber: 'C-2002', | ||
| CallAddress: '200 River Road', | ||
| Status: 0, | ||
| EstablishedOn: '2026-07-25T11:00:00Z', | ||
| CommanderName: 'Jordan Lee', | ||
| CommandPostLocationText: 'Community center', | ||
| AssignedPersonnelCount: 5, | ||
| AssignedUnitCount: 2, | ||
| }, | ||
| ]; | ||
|
|
||
| describe('IncidentsScreen search', () => { | ||
| beforeEach(() => { | ||
| useIncidentsStore.setState({ | ||
| summaries, | ||
| includeClosed: false, | ||
| isLoading: false, | ||
| error: null, | ||
| }); | ||
| }); | ||
|
|
||
| it('filters incidents by searchable summary fields', () => { | ||
| const { unmount } = render(<IncidentsScreen />); | ||
|
|
||
| fireEvent.changeText(screen.getByTestId('incidents-search'), 'C-2002'); | ||
|
|
||
| expect(screen.queryByTestId('incident-summary-ic-1')).toBeNull(); | ||
| expect(screen.getByTestId('incident-summary-ic-2')).toBeTruthy(); | ||
| unmount(); | ||
| }); | ||
|
|
||
| it('clears the search and restores the incident list', () => { | ||
| const { unmount } = render(<IncidentsScreen />); | ||
|
|
||
| fireEvent.changeText(screen.getByTestId('incidents-search'), 'warehouse'); | ||
| expect(screen.queryByTestId('incident-summary-ic-2')).toBeNull(); | ||
|
|
||
| fireEvent.press(screen.getByTestId('incidents-search-clear')); | ||
|
|
||
| expect(screen.getByTestId('incident-summary-ic-1')).toBeTruthy(); | ||
| expect(screen.getByTestId('incident-summary-ic-2')).toBeTruthy(); | ||
| unmount(); | ||
| }); | ||
|
|
||
| it('shows a search-specific empty state when no incidents match', () => { | ||
| const { unmount } = render(<IncidentsScreen />); | ||
|
|
||
| fireEvent.changeText(screen.getByTestId('incidents-search'), 'not-a-real-incident'); | ||
|
|
||
| expect(screen.getByText('common.no_results_found')).toBeTruthy(); | ||
| expect(screen.getByText('incidents.no_search_results_description')).toBeTruthy(); | ||
| unmount(); | ||
| }); | ||
| }); |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number
15000used for the axios timeout obscures intent and complicates future tuning. Extract a shared constant such asDEFAULT_REQUEST_TIMEOUT_MS = 15000to allow consistent reuse across the codebase.Kody rule violation: Replace magic numbers with named constants
Prompt for LLM
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with π or π to help Kody learn from this interaction.
ββ