Skip to content

Commit b64bb8d

Browse files
committed
improve test
1 parent 32730f8 commit b64bb8d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/autodeploy.test.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ test("properly escapes image names", () => {
3030
);
3131
});
3232

33-
function dummyApi(url) {
33+
function dummyApi(statusCode) {
3434
const api = new AutoDeployApi("dummy", "dummy");
35-
api.redeployUrl = () => url;
35+
api.client.postJson = () => ({ statusCode });
3636
return api;
3737
}
3838

3939
test("returns successfully on 2xx status codes", async () => {
40-
const api = dummyApi("https://httpbin.org/post");
40+
const api = dummyApi(200);
4141
const status = await api.redeploy("foo", "bar");
4242
assert.strictEqual(status, 200);
4343
});
4444

4545
test("throws on error codes", async () => {
46-
const api = dummyApi("https://httpbin.org/status/404");
46+
const api = dummyApi(404);
4747
await assert.rejects(() => api.redeploy("foo", "bar"), {
4848
message: "HTTP error 404",
4949
});

0 commit comments

Comments
 (0)