Skip to content

Commit

Permalink
test(tweet): extend coverage on getEligibleTweet
Browse files Browse the repository at this point in the history
  • Loading branch information
louisgrasset committed Nov 22, 2023
1 parent 2a36ec6 commit 1e6d41a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/helpers/tweet/__tests__/get-eligible-tweet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { keepRecentTweets, keepSelfQuotes, keepSelfReplies } from "../index.js";
jest.mock("../../../constants.js", () => {
return {
TWITTER_HANDLE: "username",
DEBUG: true,
};
});
jest.mock("../index.js", () => {
Expand All @@ -17,6 +18,16 @@ jest.mock("../index.js", () => {
});

describe("getEligibleTweet", () => {
const originalConsole = console.log;
const consoleMock = jest.fn();
beforeEach(() => {
console.log = consoleMock;
});

afterAll(() => {
console.log = originalConsole;
});

it.each`
isNotRetweet | isSelfReply | isSelfQuote | isRecentTweet | keep
${false} | ${false} | ${false} | ${false} | ${false}
Expand Down Expand Up @@ -49,6 +60,10 @@ describe("getEligibleTweet", () => {
}
: undefined,
);

if (result) {
expect(consoleMock).toHaveBeenCalledTimes(1);
}
},
);
});

0 comments on commit 1e6d41a

Please sign in to comment.