Skip to content

Commit

Permalink
test(quote): prevent quoting unavailable tweet
Browse files Browse the repository at this point in the history
  • Loading branch information
louisgrasset committed Nov 19, 2023
1 parent f21387b commit 2ce64b7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/helpers/tweet/__tests__/keep-self-quotes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe("keepSelfQuotes", () => {
describe("when the tweet is a quote", () => {
it("should return true when is from the same user", async () => {
const result = await keepSelfQuotes({
isQuoted: true,
quotedStatus: { username: "username" },
} as unknown as Tweet);

Expand All @@ -20,6 +21,7 @@ describe("keepSelfQuotes", () => {

it("should return false when is from a different user", async () => {
const result = await keepSelfQuotes({
isQuoted: true,
quotedStatus: { username: "potatoinc" },
} as unknown as Tweet);

Expand All @@ -34,4 +36,15 @@ describe("keepSelfQuotes", () => {
expect(result).toBe(true);
});
});

describe("when the tweet is a quote from a unavailable tweet", () => {
it("should return true when is from the same user", async () => {
const result = await keepSelfQuotes({
isQuoted: true,
quotedStatus: undefined,
} as unknown as Tweet);

expect(result).toBe(false);
});
});
});

0 comments on commit 2ce64b7

Please sign in to comment.