fix: Use the correct defaults for the invite token expiry (#10344)
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
import { IUserModuleService } from "@medusajs/framework/types/dist/user"
|
||||
import { IUserModuleService } from "@medusajs/framework/types"
|
||||
import { Modules, UserEvents } from "@medusajs/framework/utils"
|
||||
import {
|
||||
MockEventBusService,
|
||||
moduleIntegrationTestRunner,
|
||||
} from "@medusajs/test-utils"
|
||||
import jwt, { JwtPayload } from "jsonwebtoken"
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
const today = new Date()
|
||||
const expireDate = new Date(today.setDate(today.getDate() + 10))
|
||||
const expireDate = new Date().setMilliseconds(
|
||||
new Date().getMilliseconds() + 60 * 60 * 24
|
||||
)
|
||||
|
||||
const defaultInviteData = [
|
||||
{
|
||||
@@ -111,6 +113,11 @@ moduleIntegrationTestRunner<IUserModuleService>({
|
||||
id,
|
||||
})
|
||||
)
|
||||
|
||||
const tokenContent = jwt.decode(invite.token) as JwtPayload
|
||||
expect(tokenContent.exp).toBeLessThanOrEqual(
|
||||
Date.now() / 1000 + 60 * 60 * 24
|
||||
)
|
||||
})
|
||||
|
||||
it("should throw an error when an invite with the given id does not exist", async () => {
|
||||
|
||||
Reference in New Issue
Block a user