fix: update dependencies to latest
This commit is contained in:
@ -1,45 +1,46 @@
|
||||
import type { User } from '@prisma/client'
|
||||
import sinon from 'sinon'
|
||||
|
||||
import { refreshTokenExample } from '../../models/RefreshToken.js'
|
||||
import type { UserJWT } from '../../models/User.js'
|
||||
import { userExample } from '../../models/User.js'
|
||||
import { userSettingsExample } from '../../models/UserSettings.js'
|
||||
import { refreshTokenExample } from '#src/models/RefreshToken.js'
|
||||
import type { UserJWT } from '#src/models/User.js'
|
||||
import { userExample } from '#src/models/User.js'
|
||||
import { userSettingsExample } from '#src/models/UserSettings.js'
|
||||
import {
|
||||
generateAccessToken,
|
||||
generateRefreshToken
|
||||
} from '../../tools/utils/jwtToken.js'
|
||||
import prisma from '../../tools/database/prisma.js'
|
||||
} from '#src/tools/utils/jwtToken.js'
|
||||
import prisma from '#src/tools/database/prisma.js'
|
||||
|
||||
const userStubValue = {
|
||||
findUnique: async () => {
|
||||
return userExample
|
||||
}
|
||||
}
|
||||
const userSettingStubValue = {
|
||||
findFirst: async () => {
|
||||
return userSettingsExample
|
||||
}
|
||||
}
|
||||
const oAuthStubValue = {
|
||||
findMany: async () => {
|
||||
return []
|
||||
}
|
||||
}
|
||||
const refreshTokenStubValue = {
|
||||
create: async () => {
|
||||
return refreshTokenExample
|
||||
}
|
||||
}
|
||||
|
||||
export const authenticateUserTest = async (): Promise<{
|
||||
accessToken: string
|
||||
refreshToken: string
|
||||
user: User
|
||||
userStubValue: any
|
||||
userSettingStubValue: any
|
||||
oAuthStubValue: any
|
||||
refreshTokenStubValue: any
|
||||
userStubValue: typeof userStubValue
|
||||
userSettingStubValue: typeof userSettingStubValue
|
||||
oAuthStubValue: typeof oAuthStubValue
|
||||
refreshTokenStubValue: typeof refreshTokenStubValue
|
||||
}> => {
|
||||
const userStubValue = {
|
||||
findUnique: async () => {
|
||||
return userExample
|
||||
}
|
||||
}
|
||||
const userSettingStubValue = {
|
||||
findFirst: async () => {
|
||||
return userSettingsExample
|
||||
}
|
||||
}
|
||||
const oAuthStubValue = {
|
||||
findMany: async () => {
|
||||
return []
|
||||
}
|
||||
}
|
||||
const refreshTokenStubValue = {
|
||||
create: async () => {
|
||||
return refreshTokenExample
|
||||
}
|
||||
}
|
||||
sinon.stub(prisma, 'user').value(userStubValue)
|
||||
sinon.stub(prisma, 'userSetting').value(userSettingStubValue)
|
||||
sinon.stub(prisma, 'oAuth').value(oAuthStubValue)
|
||||
|
Reference in New Issue
Block a user