@@ -3,9 +3,6 @@ import * as NodeFS from "node:fs";
33import * as NodeOS from "node:os" ;
44import * as NodePath from "node:path" ;
55import { assert , describe , it } from "@effect/vitest" ;
6- import { vi } from "vite-plus/test" ;
7-
8- vi . mock ( "node:fs" , { spy : true } ) ;
96
107import { openClerkTokenStorage , type ClerkTokenStorage } from "./ClerkTokenStore.ts" ;
118
@@ -91,24 +88,6 @@ describePosix("ClerkTokenStore", () => {
9188 } ) ;
9289 } ) ;
9390
94- it ( "removes the legacy token file when the private copy already exists" , async ( ) => {
95- await withStateDir ( ( stateDir ) => {
96- const directory = NodePath . join ( stateDir , "clerk" ) ;
97- const legacyPath = NodePath . join ( stateDir , "clerk-tokens.json" ) ;
98- const tokenPath = NodePath . join ( directory , "clerk-tokens.json" ) ;
99- NodeFS . mkdirSync ( directory , { mode : 0o755 } ) ;
100- writeLoose ( legacyPath , "stale-credential" ) ;
101- writeLoose ( tokenPath , "kept-credential" ) ;
102-
103- openClerkTokenStorage ( stateDir , ( ) => idleStorage ( ) ) ;
104-
105- assert . equal ( NodeFS . existsSync ( legacyPath ) , false ) ;
106- assert . equal ( modeOf ( directory ) , 0o700 ) ;
107- assert . equal ( modeOf ( tokenPath ) , 0o600 ) ;
108- assert . equal ( NodeFS . readFileSync ( tokenPath , "utf8" ) , "kept-credential" ) ;
109- } ) ;
110- } ) ;
111-
11291 it ( "resolves a relative state directory before opening storage" , async ( ) => {
11392 await withStateDir ( async ( stateDir ) => {
11493 const relativeStateDir = NodePath . relative ( process . cwd ( ) , stateDir ) ;
@@ -150,23 +129,6 @@ describePosix("ClerkTokenStore", () => {
150129 } ) ;
151130 } ) ;
152131
153- it ( "migrates tokens when the legacy directory is on another filesystem" , async ( ) => {
154- await withStateDir ( ( stateDir ) => {
155- const legacyPath = NodePath . join ( stateDir , "clerk-tokens.json" ) ;
156- writeLoose ( legacyPath , "existing-session" ) ;
157- using _rename = vi . spyOn ( NodeFS , "renameSync" ) . mockImplementation ( ( ) => {
158- throw Object . assign ( new Error ( "cross-device link" ) , { code : "EXDEV" } ) ;
159- } ) ;
160-
161- openClerkTokenStorage ( stateDir , idleStorage ) ;
162-
163- const tokenPath = NodePath . join ( stateDir , "clerk" , "clerk-tokens.json" ) ;
164- assert . equal ( NodeFS . readFileSync ( tokenPath , "utf8" ) , "existing-session" ) ;
165- assert . equal ( modeOf ( tokenPath ) , 0o600 ) ;
166- assert . equal ( NodeFS . existsSync ( legacyPath ) , false ) ;
167- } ) ;
168- } ) ;
169-
170132 it ( "does not follow a symlinked clerk directory or token file" , async ( ) => {
171133 await withStateDir ( async ( stateDir ) => {
172134 const outsideDirectory = NodePath . join ( stateDir , "outside-dir" ) ;
0 commit comments