Skip to content

Commit

Permalink
fix: do not check success prop
Browse files Browse the repository at this point in the history
  • Loading branch information
uetchy committed Aug 24, 2021
1 parent 1ad28a0 commit 1d07654
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/services/message/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ export class MessageService {
body: JSON.stringify(body),
}
);
if (!res.success) {
throw new Error(`Failed to send message: ` + JSON.stringify(res));
}
const item = res.actions[0].addChatItemAction?.item;
if (!(item && "liveChatTextMessageRenderer" in item)) {
throw new Error(`Invalid response: ` + item);
Expand Down
4 changes: 2 additions & 2 deletions tests/message.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ describe("send message", () => {
const res = await mc.sendMessage(msg);
completeRecording();

if ("error" in res) {
throw res.error;
if (!res || "error" in res) {
throw new Error("invalid res");
}

expect(res).toMatchObject({
Expand Down

0 comments on commit 1d07654

Please sign in to comment.