Bug 1735724 - Add unit test for 200 OK with empty tiles array response from Contile. r=nanj

Differential Revision: https://phabricator.services.mozilla.com/D129088
This commit is contained in:
amy churchwell 2021-10-21 15:42:01 +00:00
Родитель bde393a961
Коммит bcf621c781
1 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -2136,6 +2136,22 @@ describe("Top Sites Feed", () => {
assert.ok(!feed._contile.sites.length);
});
it("should handle empty payload properly from Contile", async () => {
fetchStub.resolves({
ok: true,
status: 200,
json: () =>
Promise.resolve({
tiles: [],
}),
});
const fetched = await feed._contile._fetchSites();
assert.ok(fetched);
assert.ok(!feed._contile.sites.length);
});
it("should handle no content properly from Contile", async () => {
fetchStub.resolves({ ok: true, status: 204 });