Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
"devDependencies": {
"@aura-stack/tsconfig": "workspace:*",
"@aura-stack/tsdown-config": "workspace:*",
"msw": "^2.14.6",
"typescript": "catalog:typescript",
"vitest": "catalog:vitest"
}
Expand Down
3 changes: 0 additions & 3 deletions packages/core/test/actions/session/session.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ describe("sessionAction", () => {
token_type: "Bearer",
}

/**
* Mock user info response. For this case it simulates the profile function
*/
const userInfoMock = {
id: "user_123",
email: "john.doe@example.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { createAuth } from "@/createAuth.ts"
import { createCSRF } from "@/shared/crypto.ts"
import { UserIdentityArkType, UserIdentityValibot } from "@/shared/identity.ts"
import { jose, PATCH } from "@test/presets.ts"
import { describe, test, expect } from "vitest"
import { describe, test, expect, vi, afterEach } from "vitest"

afterEach(() => {
vi.unstubAllEnvs()
})

describe("updateSession action", () => {
test("invalid session", async () => {
Expand Down
5 changes: 5 additions & 0 deletions packages/core/test/mocks/node.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { setupServer } from "msw/node"

export const handlers = []

export const server = setupServer()
8 changes: 8 additions & 0 deletions packages/core/test/mocks/setupTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { beforeAll, afterEach, afterAll } from "vitest"
import { server } from "@test/mocks/node.ts"

beforeAll(() => server.listen({ onUnhandledRequest: "warn" }))

afterEach(() => server.resetHandlers())

afterAll(() => server.close())
2 changes: 2 additions & 0 deletions packages/core/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export default defineConfig({
include: ["test/**/*.test-d.ts"],
enabled: false,
},
// Causes issues with msw and global fetch mocks, need to investigate further
//setupFiles: ["test/mocks/setupTest.ts"],
},
resolve: {
alias: {
Expand Down
258 changes: 245 additions & 13 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

Loading