Skip to content

Commit

Permalink
runtime non-null assertion to coerce
Browse files Browse the repository at this point in the history
  • Loading branch information
KisaragiEffective committed Jun 20, 2024
1 parent 997b588 commit b99b7b5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/backend/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const successfulApiCall = async <E extends keyof misskey.Endpoints, P ext
const res = await api(endpoint, parameters, user);
const status = assertion.status ?? (res.body == null ? 204 : 200);
assert.strictEqual(res.status, status, inspect(res.body, { depth: 5, colors: true }));
assert.ok(res.body);
return res.body;
};

Expand All @@ -59,6 +60,7 @@ export const failedApiCall = async <T, E extends keyof misskey.Endpoints, P exte
const { status, code, id } = assertion;
const res = await api(endpoint, parameters, user);
assert.strictEqual(res.status, status, inspect(res.body));
assert.ok(res.body);
assert.strictEqual(res.body.error.code, code, inspect(res.body));
assert.strictEqual(res.body.error.id, id, inspect(res.body));
return res.body;
Expand Down

0 comments on commit b99b7b5

Please sign in to comment.