Add language endpoint to developer APIs (#41)

* Added languages endpoint and its tests
This commit is contained in:
David
2021-08-30 21:35:22 +02:00
committed by GitHub
parent 1b6c324560
commit 870ec2db64
11 changed files with 360 additions and 74 deletions

View File

@@ -24,14 +24,14 @@ describe("googleScrape", () => {
resolveFetchWith({ status });
const res = await googleScrape(source, target, query);
expect(res?.errorMsg).toMatch(/retrieving/);
expect("errorMsg" in res && res.errorMsg).toMatch(/retrieving/);
});
it("returns correct message on network error", async () => {
fetchMock.mockRejectOnce();
const res = await googleScrape(source, target, query);
expect(res?.errorMsg).toMatch(/retrieving/);
expect("errorMsg" in res && res.errorMsg).toMatch(/retrieving/);
});
it("returns correct message on parsing wrong class", async () => {
@@ -41,7 +41,7 @@ describe("googleScrape", () => {
resolveFetchWith(html);
const res = await googleScrape(source, target, query);
expect(res?.errorMsg).toMatch(/parsing/);
expect("errorMsg" in res && res.errorMsg).toMatch(/parsing/);
});
});