Skip to content

Commit

Permalink
fix test not failing if nothing is thrown
Browse files Browse the repository at this point in the history
  • Loading branch information
hfxbse committed Mar 25, 2024
1 parent 855e599 commit 3dd0d22
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/instagram.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,10 @@ describe("Login request handler", () => {
verification
})
} catch (e) {
expect.assertions(1)
expect(e.message).toStrictEqual(message ?? expect.any(String))
}

expect.assertions(1)
})
})

Expand All @@ -231,9 +232,10 @@ describe("Login request handler", () => {
try {
await login({user: "user", password: encryptedPassword, verification})
} catch (e) {
expect.assertions(1)
expect(e.message).toStrictEqual(expect.any(String))
}

expect.assertions(1)
})

test("Throws on failed request", async () => {
Expand All @@ -248,12 +250,14 @@ describe("Login request handler", () => {
headers
} as Response))


try {
await login({user: "user", password: encryptedPassword, verification})
} catch (e) {
expect.assertions(1)
expect(e.message).toStrictEqual(message)
}

expect.assertions(1)
})

test("Throws if 2FA is required", async () => {
Expand All @@ -269,8 +273,9 @@ describe("Login request handler", () => {
try {
await login({user: "user", password: encryptedPassword, verification})
} catch (e) {
expect.assertions(1)
expect(e).toBeInstanceOf(TwoFactorRequired)
}

expect.assertions(1)
})
})

0 comments on commit 3dd0d22

Please sign in to comment.