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
10 changes: 10 additions & 0 deletions src/lib/polls/downloads.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,13 @@ test("French requests preserve the API's English PDF fallback", () => {
});
assert.deepEqual(mapPollDownloads("poll", {}), {});
});

test("an uploaded report PDF is served as the poll's report download", () => {
const downloads = mapPollDownloads("poll", {
analysis_pdf: "https://example.com/api/v1/polls/poll/downloads/report_pdf_en?locale=fr&publication=build_canada",
});
assert.deepEqual(downloads, {
analysis_pdf: "/api/polls/poll/downloads/report_pdf_en?locale=fr&publication=build_canada",
});
assert.ok(POLL_DOWNLOAD_ASSETS.has("report_pdf_en") && POLL_DOWNLOAD_ASSETS.has("report_pdf_fr"));
});
3 changes: 3 additions & 0 deletions src/lib/polls/downloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ export const POLL_DOWNLOAD_ASSETS = new Set([
"analysis_markdown",
"analysis_pdf_en",
"analysis_pdf_fr",
// Published report PDF; when a poll has one, York Factory serves it as analysis_pdf.
"report_pdf_en",
"report_pdf_fr",
"crosstabs_pdf_en",
"crosstabs_pdf_fr",
"crosstabs_json",
Expand Down
Loading