* Initial RESTful API

* RESTful API tests

* Scrapping error handling refactored

* Initial GraphQL API

* GraphQL API tests
This commit is contained in:
David
2021-03-28 23:17:47 +02:00
committed by GitHub
parent 7288e9ace7
commit 2938f780aa
15 changed files with 1873 additions and 671 deletions

View File

@@ -19,11 +19,12 @@ describe("googleScrape", () => {
expect(await googleScrape(source, target, query)).toStrictEqual({ translationRes });
});
it("returns status code on request error", async () => {
it("returns correct message on request error", async () => {
const status = faker.random.number({ min: 400, max: 499 });
resolveFetchWith({ status });
expect(await googleScrape(source, target, query)).toStrictEqual({ statusCode: status });
const res = await googleScrape(source, target, query);
expect(res?.errorMsg).toMatch(/retrieving/);
});
it("returns correct message on network error", async () => {