-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(type): implemented resource type (#319)
- Loading branch information
1 parent
785e12c
commit ff23416
Showing
12 changed files
with
129 additions
and
56 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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,21 @@ | ||
import { mapRecreationFeatureCode } from './mapRecreationFeatureCode'; | ||
|
||
describe('mapRecreationFeatureCode', () => { | ||
it('should return correct description for known codes', () => { | ||
expect(mapRecreationFeatureCode('RTR')).toBe('Recreation Trail'); | ||
expect(mapRecreationFeatureCode('SIT')).toBe('Recreation Site'); | ||
expect(mapRecreationFeatureCode('RR')).toBe('Recreation Reserve'); | ||
expect(mapRecreationFeatureCode('IF')).toBe('Interpretive Forest'); | ||
}); | ||
|
||
it('should return "Unknown Feature" for unknown codes', () => { | ||
expect(mapRecreationFeatureCode('XYZ')).toBe('Unknown Feature'); | ||
expect(mapRecreationFeatureCode('')).toBe('Unknown Feature'); | ||
expect(mapRecreationFeatureCode('123')).toBe('Unknown Feature'); | ||
}); | ||
|
||
it('should handle case sensitivity correctly', () => { | ||
expect(mapRecreationFeatureCode('rtr')).toBe('Unknown Feature'); | ||
expect(mapRecreationFeatureCode('sit')).toBe('Unknown Feature'); | ||
}); | ||
}); |
This file contains 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,14 @@ | ||
enum RecreationFeatureCode { | ||
RTR = 'Recreation Trail', | ||
SIT = 'Recreation Site', | ||
RR = 'Recreation Reserve', | ||
IF = 'Interpretive Forest', | ||
} | ||
|
||
const recreationFeatureMap = new Map<string, string>( | ||
Object.entries(RecreationFeatureCode), | ||
); | ||
|
||
export const mapRecreationFeatureCode = (code: string): string => { | ||
return recreationFeatureMap.get(code) ?? 'Unknown Feature'; | ||
}; |
Oops, something went wrong.