@@ -18,19 +18,21 @@ test("一封只带来的行整行替换,没出现的 id 留着上一次的", (
1818 {
1919 collectedAt : "2026-09-05T12:00:00.000Z" ,
2020 agents : [
21- { id : "claude" , plan : { tier : "max" , label : "Max" } , limits : [ window ] , limitsError : null } ,
22- { id : "codex" , plan : null , limits : [ ] , limitsError : "过期" } ,
21+ { id : "claude" , plan : { tier : "max" , label : "Max" } , limits : [ window ] , limitsError : null , authRefreshExpiresAt : 9_000 } ,
22+ { id : "codex" , plan : null , limits : [ ] , limitsError : "过期" , authRefreshExpiresAt : null } ,
2323 ] ,
2424 } ,
2525 1_000 ,
2626 ) ;
2727 assert . equal ( first . agents . claude ?. updatedAt , 1_000 ) ;
28+ assert . equal ( first . agents . claude ?. authRefreshExpiresAt , 9_000 ) ;
29+ assert . equal ( Object . hasOwn ( first . agents . codex ?? { } , "authRefreshExpiresAt" ) , false ) ;
2830
2931 const second = mergeAgentLimits (
3032 first ,
3133 {
3234 collectedAt : "2026-09-05T12:10:00.000Z" ,
33- agents : [ { id : "claude" , plan : null , limits : [ ] , limitsError : "token expired" } ] ,
35+ agents : [ { id : "claude" , plan : null , limits : [ ] , limitsError : "token expired" , authRefreshExpiresAt : null } ] ,
3436 } ,
3537 2_000 ,
3638 ) ;
@@ -48,16 +50,17 @@ test("一封只带来的行整行替换,没出现的 id 留着上一次的", (
4850test ( "按 id 取限额:取到的带上收到时刻,没上报过或这份还没到按「没配」" , ( ) => {
4951 const stored = {
5052 agents : {
51- claude : { plan : { tier : "max" , label : "Max" } , limits : [ window ] , limitsError : null , updatedAt : 4_000 } ,
53+ claude : { plan : { tier : "max" , label : "Max" } , limits : [ window ] , limitsError : null , authRefreshExpiresAt : 9_000 , updatedAt : 4_000 } ,
5254 } ,
5355 } ;
5456 assert . deepEqual ( agentLimitsOf ( stored , "claude" ) , {
5557 plan : { tier : "max" , label : "Max" } ,
5658 limits : [ window ] ,
5759 limitsError : null ,
60+ authRefreshExpiresAt : 9_000 ,
5861 limitsAt : 4_000 ,
5962 } ) ;
60- const none = { plan : null , limits : [ ] , limitsError : null , limitsAt : null } ;
63+ const none = { plan : null , limits : [ ] , limitsError : null , authRefreshExpiresAt : null , limitsAt : null } ;
6164 assert . deepEqual ( agentLimitsOf ( stored , "cursor" ) , none ) ;
6265 assert . deepEqual ( agentLimitsOf ( null , "claude" ) , none ) ;
6366 assert . deepEqual ( agentLimitsOf ( stored , "constructor" ) , none ) ;
0 commit comments