serlo / cloudflare-worker

Cloudflare worker which works as a proxy for https://serlo.org/
Apache License 2.0
9 stars 1 forks source link

Test improvement: Check for succesful requests #62

Closed kulla closed 3 years ago

kulla commented 4 years ago

At __tests__/frontend-proxy.ts we have a function expectRequestFrom() which checks that a request was made from the right backend: https://github.com/serlo/serlo.org-cloudflare-worker/blob/1645aa0ab5924c6f4b411b865fca00142f308c2d/__tests__/frontend-proxy.ts#L542-L555

However there is code in the unit tests which also check for successful requests: https://github.com/serlo/serlo.org-cloudflare-worker/blob/1645aa0ab5924c6f4b411b865fca00142f308c2d/__tests__/index.ts#L39-L45

So there is the possibility to create a new helper function which is an abstraction of all those test cases and which can be used to shorten the test code and to make it more readable.

kulla commented 3 years ago

This test does not follow the philosophy of https://github.com/serlo/serlo.org-cloudflare-worker/issues/76 and thus would be only a temporary improvement -> we shouldn't implement this...