| ... | ... | @@ -22,8 +22,8 @@ describe("checkProviderStatusesOnStartup", () => { |
| 22 | 22 | if (args.join(" ") === "--version") { |
| 23 | 23 | return result({ stdout: "codex 1.0.0\n" }); |
| 24 | 24 | } |
| 25 | | if (args.join(" ") === "auth status --json") { |
| 26 | | return result({ stdout: '{"authenticated":true}\n' }); |
| 25 | if (args.join(" ") === "login status") { |
| 26 | return result({ stdout: "Logged in\n" }); |
| 27 | 27 | } |
| 28 | 28 | throw new Error(`Unexpected command: ${args.join(" ")}`); |
| 29 | 29 | }); |
| ... | ... | @@ -59,7 +59,7 @@ describe("checkProviderStatusesOnStartup", () => { |
| 59 | 59 | if (args.join(" ") === "--version") { |
| 60 | 60 | return result({ stdout: "codex 1.0.0\n" }); |
| 61 | 61 | } |
| 62 | | if (args.join(" ") === "auth status --json") { |
| 62 | if (args.join(" ") === "login status") { |
| 63 | 63 | return result({ |
| 64 | 64 | code: 1, |
| 65 | 65 | stderr: "Not logged in. Run codex login.", |
| ... | ... | @@ -79,14 +79,15 @@ describe("checkProviderStatusesOnStartup", () => { |
| 79 | 79 | ]); |
| 80 | 80 | }); |
| 81 | 81 | |
| 82 | | it("returns unauthenticated when auth probe JSON array includes authenticated=false", async () => { |
| 82 | it("returns unauthenticated when login status output includes 'not logged in'", async () => { |
| 83 | 83 | const status = await checkProviderStatusesOnStartup(async (_command, args) => { |
| 84 | 84 | if (args.join(" ") === "--version") { |
| 85 | 85 | return result({ stdout: "codex 1.0.0\n" }); |
| 86 | 86 | } |
| 87 | | if (args.join(" ") === "auth status --json") { |
| 87 | if (args.join(" ") === "login status") { |
| 88 | 88 | return result({ |
| 89 | | stdout: '[{"authenticated":false}]\n', |
| 89 | code: 1, |
| 90 | stdout: "Not logged in\n", |
| 90 | 91 | }); |
| 91 | 92 | } |
| 92 | 93 | throw new Error(`Unexpected command: ${args.join(" ")}`); |
| ... | ... | @@ -103,41 +104,15 @@ describe("checkProviderStatusesOnStartup", () => { |
| 103 | 104 | ]); |
| 104 | 105 | }); |
| 105 | 106 | |
| 106 | | it("returns warning when auth probe JSON array has no auth marker", async () => { |
| 107 | | const status = await checkProviderStatusesOnStartup(async (_command, args) => { |
| 108 | | if (args.join(" ") === "--version") { |
| 109 | | return result({ stdout: "codex 1.0.0\n" }); |
| 110 | | } |
| 111 | | if (args.join(" ") === "auth status --json") { |
| 112 | | return result({ |
| 113 | | code: 0, |
| 114 | | stdout: '[{"ok":true}]\n', |
| 115 | | }); |
| 116 | | } |
| 117 | | throw new Error(`Unexpected command: ${args.join(" ")}`); |
| 118 | | }); |
| 119 | | |
| 120 | | expect(status).toEqual([ |
| 121 | | expect.objectContaining({ |
| 122 | | provider: "codex", |
| 123 | | status: "warning", |
| 124 | | available: true, |
| 125 | | authStatus: "unknown", |
| 126 | | message: |
| 127 | | "Could not verify Codex authentication status from JSON output (missing auth marker).", |
| 128 | | }), |
| 129 | | ]); |
| 130 | | }); |
| 131 | | |
| 132 | | it("returns warning when auth status command is unsupported", async () => { |
| 107 | it("returns warning when login status command is unsupported", async () => { |
| 133 | 108 | const status = await checkProviderStatusesOnStartup(async (_command, args) => { |
| 134 | 109 | if (args.join(" ") === "--version") { |
| 135 | 110 | return result({ stdout: "codex 1.0.0\n" }); |
| 136 | 111 | } |
| 137 | | if (args.join(" ") === "auth status --json") { |
| 112 | if (args.join(" ") === "login status") { |
| 138 | 113 | return result({ |
| 139 | 114 | code: 2, |
| 140 | | stderr: "error: unknown command 'auth'", |
| 115 | stderr: "error: unknown command 'login'", |
| 141 | 116 | }); |
| 142 | 117 | } |
| 143 | 118 | throw new Error(`Unexpected command: ${args.join(" ")}`); |