Repository navigation
RC-T46 Map Updates for Custom Markers #78
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
Changes from 1 commit
Commits
Show all changes
3 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
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
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
67 changes: 67 additions & 0 deletions
67
src/components/calls/__tests__/call-card-type-icon.test.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,67 @@ | ||
| import { render, screen } from '@testing-library/react-native'; | ||
| import React from 'react'; | ||
|
|
||
| jest.mock('react-i18next', () => ({ | ||
| useTranslation: () => ({ t: (key: string) => key }), | ||
| })); | ||
|
|
||
| jest.mock('lucide-react-native', () => { | ||
| const React = require('react'); | ||
| const icon = (name: string) => (props: any) => React.createElement('View', { ...props, testID: `mock-${name}-icon` }); | ||
| return { | ||
| AlertTriangle: icon('alert-triangle'), | ||
| ClipboardList: icon('clipboard-list'), | ||
| MapPin: icon('map-pin'), | ||
| Phone: icon('phone'), | ||
| Timer: icon('timer'), | ||
| }; | ||
| }); | ||
|
|
||
| jest.mock('expo-image', () => { | ||
| const React = require('react'); | ||
| return { Image: (props: any) => React.createElement('View', props) }; | ||
| }); | ||
|
|
||
| jest.mock('@/components/ui/html-renderer', () => ({ | ||
| HtmlRenderer: () => null, | ||
| })); | ||
|
|
||
| import { MAP_ICONS } from '@/constants/map-icons'; | ||
| import { type CallResultData } from '@/models/v4/calls/callResultData'; | ||
|
|
||
| import { CallCard } from '../call-card'; | ||
|
|
||
| const baseCall = { | ||
| CallId: '42', | ||
| Number: '2026-42', | ||
| Name: 'Structure fire', | ||
| Nature: '', | ||
| Address: '1 Main St', | ||
| Priority: 0, | ||
| LoggedOnUtc: '2026-10-21T10:00:00Z', | ||
| } as CallResultData; | ||
|
|
||
| const getTypeIcon = () => screen.getByTestId('call-card-type-icon-42', { includeHiddenElements: true }); | ||
|
|
||
| describe('CallCard call type icon', () => { | ||
| it('shows the uploaded call-type icon in place of the alert glyph', () => { | ||
| const iconUrl = 'https://api.resgrid.dev/api/v4/TypeIcons/fire-key'; | ||
| render(<CallCard priority={undefined} call={{ ...baseCall, TypeIconUrl: iconUrl, TypeMapIcon: 'fire' } as CallResultData} />); | ||
|
|
||
| expect(getTypeIcon().props.source).toEqual({ uri: iconUrl }); | ||
| expect(screen.queryByTestId('mock-alert-triangle-icon')).toBeNull(); | ||
| }); | ||
|
|
||
| it('uses the built-in call icon the type picked when nothing was uploaded', () => { | ||
| render(<CallCard priority={undefined} call={{ ...baseCall, TypeIconUrl: null, TypeMapIcon: 'caraccident' } as CallResultData} />); | ||
|
|
||
| expect(getTypeIcon().props.source).toBe(MAP_ICONS.caraccident.uri); | ||
| }); | ||
|
|
||
| it('keeps the alert glyph when older servers omit the type icon fields', () => { | ||
| render(<CallCard priority={undefined} call={baseCall} />); | ||
|
|
||
| expect(screen.queryByTestId('call-card-type-icon-42', { includeHiddenElements: true })).toBeNull(); | ||
| expect(screen.getByTestId('mock-alert-triangle-icon')).toBeTruthy(); | ||
| }); | ||
| }); |
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
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.
Unhandled asynchronous assertion failures from waitFor lack operation context when the incident map pin assertion rejects. Wrap the awaited waitFor call in try/catch and throw a new Error with the message "Failed to verify incident map pins" and the original error as its cause.
Kody rule violation: Handle async operations with proper error handling
Prompt for LLM
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.