| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import { mockNuxtImport } from "@nuxt/test-utils/runtime"
- import { NIL as NIL_UUID } from "uuid"
- function inYearsFromNow(years) {
- const now = new Date()
- const YEAR_IN_MS = 365 * 24 * 60 * 60 * 1000
- return new Date().setTime(now.getTime() + years * YEAR_IN_MS)
- }
- const user = {
- name: "Test User",
- email: "test@example.com",
- role: "user",
- username: "test",
- id: NIL_UUID
- }
- const session = {
- token: "0".repeat(32),
- userId: user.id,
- id: NIL_UUID,
- createdAt: now,
- updatedAt: now,
- expiresAt: inYearsFromNow(20)
- }
- mockNuxtImport("useAuthClient", () => {
- return () => {
- return {
- user: ref(user),
- session: ref(session),
- isSignedIn: ref(true),
- signIn: () => null,
- signUp: () => null,
- signOut: () => null,
- fetchSession: () => ({ session, user }),
- authClient: {}
- }
- }
- })
|