@@ -47,6 +47,51 @@ it.layer(NodeServices.layer)("Claude authentication status", (it) => {
4747 auth : "unknown" ,
4848 status : "warning" ,
4949 } ,
50+ {
51+ name : "API-key authentication succeeds" ,
52+ output : '{"loggedIn":true}' ,
53+ code : 0 ,
54+ auth : "authenticated" ,
55+ status : "ready" ,
56+ tokenSource : "apiKey" ,
57+ backendType : "apiKey" ,
58+ } ,
59+ {
60+ name : "failed API-key auth retains identity without claiming readiness" ,
61+ output : '{"loggedIn":false}' ,
62+ code : 1 ,
63+ auth : "unauthenticated" ,
64+ status : "error" ,
65+ tokenSource : "apiKey" ,
66+ backendType : "apiKey" ,
67+ } ,
68+ {
69+ name : "Bedrock authentication succeeds" ,
70+ output : '{"loggedIn":true}' ,
71+ code : 0 ,
72+ auth : "authenticated" ,
73+ status : "ready" ,
74+ apiProvider : "bedrock" ,
75+ backendType : "bedrock" ,
76+ } ,
77+ {
78+ name : "Bedrock auth failure does not suggest OAuth login" ,
79+ output : '{"loggedIn":false}' ,
80+ code : 1 ,
81+ auth : "unauthenticated" ,
82+ status : "error" ,
83+ apiProvider : "bedrock" ,
84+ backendType : "bedrock" ,
85+ } ,
86+ {
87+ name : "unknown Bedrock auth retains identity without trusting initialization" ,
88+ output : "{}" ,
89+ code : 0 ,
90+ auth : "unknown" ,
91+ status : "warning" ,
92+ apiProvider : "bedrock" ,
93+ backendType : "bedrock" ,
94+ } ,
5095 ] ) {
5196 it . effect ( testCase . name , ( ) =>
5297 Effect . gen ( function * ( ) {
@@ -71,8 +116,8 @@ it.layer(NodeServices.layer)("Claude authentication status", (it) => {
71116 Effect . succeed ( {
7211773118 subscriptionType : "pro" ,
74- tokenSource : "oauth" ,
75- apiProvider : "firstParty" ,
119+ tokenSource : "tokenSource" in testCase ? testCase . tokenSource : " oauth",
120+ apiProvider : "apiProvider" in testCase ? testCase . apiProvider : " firstParty",
76121 models : [ ] ,
77122 slashCommands : [ ] ,
78123 autoModeDisabled : true ,
@@ -85,6 +130,12 @@ it.layer(NodeServices.layer)("Claude authentication status", (it) => {
85130 assert . equal ( result . status , testCase . status ) ;
86131 if ( testCase . auth !== "authenticated" ) assert . equal ( result . auth . email , undefined ) ;
87132 assert . equal ( result . message ?. includes ( "private invalid output" ) ?? false , false ) ;
133+ if ( "backendType" in testCase ) {
134+ assert . equal ( result . auth . type , testCase . backendType ) ;
135+ assert . equal ( result . message ?. includes ( "claude auth login" ) ?? false , false ) ;
136+ } else if ( testCase . auth !== "authenticated" ) {
137+ assert . equal ( result . auth . type , undefined ) ;
138+ }
88139 } ) ,
89140 ) ;
90141 }
0 commit comments