-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add subtitle facet to SearchHeader
- Loading branch information
Maham Akif
authored and
Maham Akif
committed
Mar 26, 2024
1 parent
83e8405
commit fc6d981
Showing
3 changed files
with
65 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { | ||
SEARCH_FACET_FILTERS, | ||
ADDITIONAL_FACET_FILTERS, | ||
} from '../constants'; | ||
|
||
jest.mock('../../config', () => ({ | ||
__esModule: true, | ||
features: { | ||
ENROLL_WITH_CODES: true, | ||
LANGUAGE_FACET: true, | ||
PROGRAM_TITLES_FACET: true, | ||
LEARNING_TYPE_FACET: true, | ||
ENABLE_PATHWAYS: true, | ||
SUBTITLE_FACET: true, | ||
}, | ||
})); | ||
|
||
describe('Constants', () => { | ||
test('Search facet filters are defined correctly', () => { | ||
expect(SEARCH_FACET_FILTERS).toHaveLength(9); | ||
}); | ||
|
||
test('Additional facet filters are defined correctly', () => { | ||
expect(Array.isArray(ADDITIONAL_FACET_FILTERS)).toBe(true); | ||
}); | ||
|
||
test('Language facet filter is added when feature is enabled', () => { | ||
const languageFacet = SEARCH_FACET_FILTERS.find( | ||
(facet) => facet.attribute === 'language', | ||
); | ||
expect(languageFacet).toBeDefined(); | ||
expect(languageFacet.title).toBe('Language'); | ||
expect(languageFacet.isSortedAlphabetical).toBe(true); | ||
}); | ||
|
||
test('Learning type facet filter is added when feature is enabled', () => { | ||
const learningTypeFacet = SEARCH_FACET_FILTERS.find( | ||
(facet) => facet.attribute === 'content_type', | ||
); | ||
expect(learningTypeFacet).toBeDefined(); | ||
expect(learningTypeFacet.title).toBe('Learning type'); | ||
expect(learningTypeFacet.noDisplay).toBe(true); | ||
}); | ||
|
||
test('Subtitle facet filter is added when feature is enabled', () => { | ||
const subtitleFacet = SEARCH_FACET_FILTERS.find( | ||
(facet) => facet.attribute === 'transcript_languages', | ||
); | ||
expect(subtitleFacet).toBeDefined(); | ||
expect(subtitleFacet.title).toBe('Subtitle'); | ||
expect(subtitleFacet.isSortedAlphabetical).toBe(true); | ||
}); | ||
}); |