refactor: extract isStatusUp utility to decouple from got's response.ok and modified utils test accordingly
This commit is contained in:
1 parent
372fc9869b
commit
5628c202f7
5 files changed
+50
-8
No files matched your search
@@ -254,14 +254,13 @@ describe("HttpProvider", () => {
|
||||
expect(result.extracted).toBe("value");
|
||||
});
|
||||
|
||||
it("sets status to false when response.ok is false even if matcher passes", async () => {
|
||||
it("sets status to false when status code is non-2xx even if matcher passes", async () => {
|
||||
mockGot.mockResolvedValue(makeGotResponse({ ok: false, statusCode: 301 }));
|
||||
const matcher = createMockMatcher({ ok: true, message: "Success" });
|
||||
const { provider } = createProvider(matcher);
|
||||
|
||||
const result = await provider.handle(makeMonitor());
|
||||
|
||||
// status = response.ok && matchResult.ok
|
||||
expect(result.status).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user