Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions backend/doc/domain/resource_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,8 @@ def add_data_not_supplied_by_data_api(repos_info: list[RepoEntry]) -> list[RepoE
"""
DOC needs to support some resources which are not supplied by the
data API so we augment the data returned from the data API to include
them here.
them here. If a (language code, resource type) pair already exists in
repos_info, do not add it again.
"""

def make_entry(url: HttpUrl, resource_type: str, lang: Language) -> RepoEntry:
Expand Down Expand Up @@ -774,7 +775,15 @@ def make_entry(url: HttpUrl, resource_type: str, lang: Language) -> RepoEntry:
en_lang,
),
]
repos_info.extend(extra_entries)
existing_pairs = {
(entry.content.language.ietf_code, entry.content.resource_type)
for entry in repos_info
}
for entry in extra_entries:
key = (entry.content.language.ietf_code, entry.content.resource_type)
if key not in existing_pairs:
repos_info.append(entry)
existing_pairs.add(key)
return repos_info


Expand Down
11 changes: 11 additions & 0 deletions frontend/tests/e2e/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,3 +420,14 @@ test('test burmese', async ({ page }) => {
await page.getByText('Use PrinceXml to produce the').click()
await page.getByRole('button', { name: 'Generate File' }).click()
})

test('test merge of data API data and DOC only data', async ({ page }) => {
await page.goto('http://localhost:8001/')
await expect(page.getByRole('main')).toContainText('Bahasa Indonesia (Indonesian)')
await page.getByLabel('Bahasa Indonesia (Indonesian').check()
await page.getByRole('button', { name: 'Next' }).click()
await page.getByText('Matius').click()
await page.getByRole('button', { name: 'Next' }).click()
await expect(page.locator('body')).toContainText('Bahasa Indonesian Bible')
await expect(page.locator('body')).toContainText('Translation Notes')
})