-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Use the correct defaults for the invite token expiry
- Loading branch information
Showing
3 changed files
with
43 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,6 +156,35 @@ medusaIntegrationTestRunner({ | |
expect(e.response.data.message).toEqual("Unauthorized") | ||
}) | ||
}) | ||
|
||
it("should fail to accept with an expired token", async () => { | ||
jest.useFakeTimers() | ||
|
||
const signup = await api.post("/auth/user/emailpass/register", { | ||
email: "[email protected]", | ||
password: "secret_password", | ||
}) | ||
|
||
// Advance time by 25 hours | ||
jest.advanceTimersByTime(25 * 60 * 60 * 1000) | ||
|
||
await api | ||
.post( | ||
`/admin/invites/accept?token=${invite.token}`, | ||
{ | ||
first_name: "Another Test", | ||
last_name: "User", | ||
}, | ||
{ | ||
headers: { authorization: `Bearer ${signup.data.token}` }, | ||
} | ||
) | ||
.catch((e) => { | ||
expect(e.response.status).toEqual(401) | ||
expect(e.response.data.message).toEqual("Unauthorized") | ||
}) | ||
}) | ||
|
||
it("should resend an invite", async () => { | ||
const resendResponse = ( | ||
await api.post(`/admin/invites/${invite.id}/resend`, {}, adminHeaders) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters