-
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: extend travel mode filter selection to use selected_as_default …
…property (#293) * set tranposrt mode filters using selected_as_default flag from firestore. * extend filter.fixture with selected_as_default property. * add .env.nfk to gitignore. * remove exessive useEffect.
- Loading branch information
1 parent
a4453ce
commit bc036ab
Showing
7 changed files
with
54 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ yarn-error.log* | |
.env*.local | ||
.env*.atb | ||
.env*.fram | ||
.env*.nfk | ||
|
||
# vercel | ||
.vercel | ||
|
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
26 changes: 26 additions & 0 deletions
26
src/page-modules/assistant/__tests__/set-transport-mode-filters.test.ts
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,26 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import { setTransportModeFilters } from '../utils'; | ||
import { TravelSearchFiltersType } from '@atb-as/config-specs'; | ||
|
||
describe('setTransportModeFilters', () => { | ||
it('should only return transport mode filters where `selectedAsDefault` is true.', () => { | ||
const tmfInput = [ | ||
{ id: 'bus', selectedAsDefault: true }, | ||
{ id: 'air', selectedAsDefault: false }, | ||
] as TravelSearchFiltersType['transportModes']; | ||
|
||
const transportModeFilters = setTransportModeFilters(tmfInput); | ||
expect(transportModeFilters).toEqual(['bus']); | ||
}); | ||
|
||
it('should not return transport mode filters where `selectedAsDefault` is undefined.', () => { | ||
const tmfInput = [ | ||
{ id: 'bus', selectedAsDefault: true }, | ||
{ id: 'air' }, | ||
{ id: 'rail', selectedAsDefault: undefined }, | ||
] as TravelSearchFiltersType['transportModes']; | ||
|
||
const transportModeFilters = setTransportModeFilters(tmfInput); | ||
expect(transportModeFilters).toEqual(['bus']); | ||
}); | ||
}); |
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