@@ -96,6 +96,33 @@ jest.mock("../ThinkingBudget", () => ({
9696 ) : null ,
9797} ) )
9898
99+ // Mock DiffSettingsControl for tests
100+ jest . mock ( "../DiffSettingsControl" , ( ) => ( {
101+ DiffSettingsControl : ( { diffEnabled, fuzzyMatchThreshold, onChange } : any ) => (
102+ < div data-testid = "diff-settings-control" >
103+ < label >
104+ Enable editing through diffs
105+ < input
106+ type = "checkbox"
107+ checked = { diffEnabled }
108+ onChange = { ( e ) => onChange ( "diffEnabled" , e . target . checked ) }
109+ />
110+ </ label >
111+ < div >
112+ Fuzzy match threshold
113+ < input
114+ type = "range"
115+ value = { fuzzyMatchThreshold || 1.0 }
116+ onChange = { ( e ) => onChange ( "fuzzyMatchThreshold" , parseFloat ( e . target . value ) ) }
117+ min = { 0.8 }
118+ max = { 1 }
119+ step = { 0.005 }
120+ />
121+ </ div >
122+ </ div >
123+ ) ,
124+ } ) )
125+
99126const renderApiOptions = ( props = { } ) => {
100127 const queryClient = new QueryClient ( )
101128
@@ -116,14 +143,23 @@ const renderApiOptions = (props = {}) => {
116143}
117144
118145describe ( "ApiOptions" , ( ) => {
119- it ( "shows temperature and rate limit controls by default" , ( ) => {
120- renderApiOptions ( )
146+ it ( "shows diff settings, temperature and rate limit controls by default" , ( ) => {
147+ renderApiOptions ( {
148+ apiConfiguration : {
149+ diffEnabled : true ,
150+ fuzzyMatchThreshold : 0.95 ,
151+ } ,
152+ } )
153+ // Check for DiffSettingsControl by looking for text content
154+ expect ( screen . getByText ( / e n a b l e e d i t i n g t h r o u g h d i f f s / i) ) . toBeInTheDocument ( )
121155 expect ( screen . getByTestId ( "temperature-control" ) ) . toBeInTheDocument ( )
122156 expect ( screen . getByTestId ( "rate-limit-seconds-control" ) ) . toBeInTheDocument ( )
123157 } )
124158
125- it ( "hides temperature and rate limit controls when fromWelcomeView is true" , ( ) => {
159+ it ( "hides all controls when fromWelcomeView is true" , ( ) => {
126160 renderApiOptions ( { fromWelcomeView : true } )
161+ // Check for absence of DiffSettingsControl text
162+ expect ( screen . queryByText ( / e n a b l e e d i t i n g t h r o u g h d i f f s / i) ) . not . toBeInTheDocument ( )
127163 expect ( screen . queryByTestId ( "temperature-control" ) ) . not . toBeInTheDocument ( )
128164 expect ( screen . queryByTestId ( "rate-limit-seconds-control" ) ) . not . toBeInTheDocument ( )
129165 } )
0 commit comments