@@ -41,7 +41,6 @@ import {
4141 listAgentUsage ,
4242 setAgentUsageSync ,
4343 uploadRows ,
44- withCurrentAgentUsageSync ,
4544} from '../agentUsage' ;
4645
4746const user = ( value : string | null ) => ( {
@@ -72,12 +71,11 @@ describe('agent usage sync setting', () => {
7271 expect ( isAgentUsageSyncOn ( ) ) . toBe ( false ) ;
7372 } ) ;
7473
75- it ( 'puts every setting with the new value for this one ' , async ( ) => {
74+ it ( 'puts only the agent usage sync value ' , async ( ) => {
7675 state . user = user ( '0' ) ;
7776 put . mockResolvedValue ( { data : { data : user ( '1' ) } } ) ;
7877 await setAgentUsageSync ( true ) ;
7978 expect ( put ) . toHaveBeenCalledWith ( 'v2/user/settings' , [
80- { id : 5 , value : 56 } ,
8179 { id : 9 , value : '1' } ,
8280 ] ) ;
8381 expect ( isAgentUsageSyncOn ( ) ) . toBe ( true ) ;
@@ -166,24 +164,3 @@ describe('uploads', () => {
166164 expect ( rows [ 1 ] ) . toMatchObject ( { task : '#2' , cost : null } ) ;
167165 } ) ;
168166} ) ;
169-
170- describe ( 'withCurrentAgentUsageSync' , ( ) => {
171- it ( 'replaces a stale cached value with the current one' , ( ) => {
172- state . user = user ( '1' ) ;
173- const stale = [
174- { id : 5 , value : 56 } ,
175- { id : 9 , value : '0' } ,
176- ] ;
177- expect ( withCurrentAgentUsageSync ( stale ) ) . toEqual ( [
178- { id : 5 , value : 56 } ,
179- { id : 9 , value : '1' } ,
180- ] ) ;
181- expect ( stale [ 1 ] . value ) . toBe ( '0' ) ;
182- } ) ;
183-
184- it ( 'leaves the list alone without the setting' , ( ) => {
185- state . user = user ( null ) ;
186- const list = [ { id : 5 , value : 56 } ] ;
187- expect ( withCurrentAgentUsageSync ( list ) ) . toBe ( list ) ;
188- } ) ;
189- } ) ;
0 commit comments