Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Add missing audio file extensions (#1540)
Krystle Salazar570e3823a478
diff --git a/src/constants/filters.ts b/src/constants/filters.tsindex 07bb29360..54571f6ea 100644--- a/src/constants/filters.ts+++ b/src/constants/filters.ts@@ -95,7 +95,7 @@ const filterCodesPerCategory = deepFreeze<Record<FilterCategory, string[]>>({'sound_effect',],imageCategories: ['photograph', 'illustration', 'digitized_artwork'],- audioExtensions: ['mp3', 'ogg', 'flac'],+ audioExtensions: ['flac', 'mid', 'mp3', 'oga', 'ogg', 'opus', 'wav', 'webm'],imageExtensions: ['jpg', 'png', 'gif', 'svg'],aspectRatios: ['tall', 'wide', 'square'],lengths: ['shortest', 'short', 'medium', 'long'],diff --git a/src/locales/en.json b/src/locales/en.jsonindex 13bb1f774..285052070 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -303,17 +303,22 @@"digitized_artwork": "Digitized Artworks"},"audio-extensions": {- "title": "File type",- "mp3": "MP3s",- "ogg": "OGGs",- "flac": "FLACs"+ "title": "Extension",+ "flac": "FLAC",+ "mid": "MID",+ "mp3": "MP3",+ "oga": "OGA",+ "ogg": "OGG",+ "opus": "OPUS",+ "wav": "WAV",+ "webm": "WEBM"},"image-extensions": {- "title": "File type",- "jpg": "JPEGs",- "png": "PNGs",- "gif": "GIFs",- "svg": "SVGs"+ "title": "Extension",+ "jpg": "JPEG",+ "png": "PNG",+ "gif": "GIF",+ "svg": "SVG"},"aspect-ratios": {"title": "Aspect ratio",diff --git a/test/playwright/e2e/filters.spec.ts b/test/playwright/e2e/filters.spec.tsindex 1caf2b8be..7605f4e28 100644--- a/test/playwright/e2e/filters.spec.ts+++ b/test/playwright/e2e/filters.spec.ts@@ -36,7 +36,7 @@ const assertCheckboxCount = async (const FILTER_COUNTS = {[ALL_MEDIA]: 11,- [AUDIO]: 27,+ [AUDIO]: 32,[IMAGE]: 70,}@@ -118,16 +118,16 @@ test('selecting some filters can disable dependent filters', async ({const byNc = page.locator('input[value="by-nc"]')await expect(byNc).toBeDisabled()for (const checkbox of ['by-nc-sa', 'by-nc-nd']) {- await assertCheckboxStatus(page, checkbox, 'disabled')+ await assertCheckboxStatus(page, checkbox, '', 'disabled')}await assertCheckboxStatus(page, 'commercial')await page.click('label:has-text("commercial")')- await assertCheckboxStatus(page, 'commercial', 'unchecked')+ await assertCheckboxStatus(page, 'commercial', '', 'unchecked')await expect(byNc).not.toBeDisabled()for (const checkbox of ['commercial', 'by-nc-sa', 'by-nc-nd']) {- await assertCheckboxStatus(page, checkbox, 'unchecked')+ await assertCheckboxStatus(page, checkbox, '', 'unchecked')}})@@ -164,7 +164,7 @@ test('new media request is sent when a filter is selected', async ({await page.goto('/search/image?q=cat')await openFilters(page)- await assertCheckboxStatus(page, 'cc0', 'unchecked')+ await assertCheckboxStatus(page, 'cc0', '', 'unchecked')const [response] = await Promise.all([page.waitForResponse((response) => response.url().includes('cc0')),@@ -190,6 +190,6 @@ for (const [searchType, source] of [)await openFilters(page)- await assertCheckboxStatus(page, source, 'checked')+ await assertCheckboxStatus(page, source, '', 'checked')})}diff --git a/test/playwright/e2e/search-query-server.spec.ts b/test/playwright/e2e/search-query-server.spec.tsindex 1ef20c3fb..3ca4ee90b 100644--- a/test/playwright/e2e/search-query-server.spec.ts+++ b/test/playwright/e2e/search-query-server.spec.ts@@ -76,9 +76,10 @@ test('url query to filter, image tab, several filters for one filter type selectquery: 'searchBy=creator&extension=jpg,png,gif,svg',})await openFilters(page)- const checkboxes = ['jpeg', 'png', 'gif', 'svgs']+ const checkboxes = ['jpeg', 'png', 'gif', 'svg']for (const checkbox of checkboxes) {- await assertCheckboxStatus(page, checkbox)+ const forValue = checkbox === 'jpeg' ? 'jpg' : checkbox+ await assertCheckboxStatus(page, checkbox, forValue)}})diff --git a/test/playwright/utils/navigation.ts b/test/playwright/utils/navigation.tsindex b5ff8a634..36ca97e1b 100644--- a/test/playwright/utils/navigation.ts+++ b/test/playwright/utils/navigation.ts@@ -75,9 +75,14 @@ export const closeMobileMenu = async (page: Page) => {export const assertCheckboxStatus = async (page: Page,label: string,+ forValue = '',status: 'checked' | 'unchecked' | 'disabled' = 'checked') => {- const checkbox = page.locator(`label:has-text('${label}')`)+ const selector =+ forValue === ''+ ? `label:has-text('${label}')`+ : `label[for="${forValue}"]:has-text('${label}')`+ const checkbox = page.locator(selector)switch (status) {case 'checked': {await expect(checkbox).not.toBeDisabled()diff --git a/test/unit/specs/stores/search-store.spec.js b/test/unit/specs/stores/search-store.spec.jsindex 9ac81cc99..0e9d26b38 100644--- a/test/unit/specs/stores/search-store.spec.js+++ b/test/unit/specs/stores/search-store.spec.js@@ -387,12 +387,12 @@ describe('Search Store', () => {searchType | nextSearchType | expectedFilterCount${AUDIO} | ${IMAGE} | ${25}${IMAGE} | ${ALL_MEDIA} | ${12}- ${IMAGE} | ${AUDIO} | ${25}+ ${IMAGE} | ${AUDIO} | ${30}${ALL_MEDIA} | ${VIDEO} | ${12}- ${VIDEO} | ${AUDIO} | ${25}+ ${VIDEO} | ${AUDIO} | ${30}${ALL_MEDIA} | ${IMAGE} | ${25}`(- 'changing searchType clears all but $expectedFilterCount $nextSearchType filters ',+ 'changing searchType from $searchType clears all but $expectedFilterCount $nextSearchType filters',async ({ searchType, nextSearchType, expectedFilterCount }) => {const searchStore = useSearchStore()searchStore.setSearchType(searchType)