@@ -149,42 +149,6 @@ describe("getExperiments", () => {
149149 ) ;
150150 } ) ;
151151
152- it ( "calls Cirrus V1 when featurn flag is disabled" , async ( ) => {
153- process . env . NIMBUS_SIDECAR_URL = "https://cirrus.example/base" ;
154- getEnabledFeatureFlagsMock . mockReturnValue ( [ ] as FeatureFlagName [ ] ) ;
155- headersMock . mockResolvedValue ( new Headers ( [ ] ) ) ;
156-
157- const featuresJson = { bar : { enabled : false } } ;
158- fetchMock . mockResolvedValue ( {
159- ok : true ,
160- status : 200 ,
161- json : ( ) => Promise . resolve ( featuresJson ) ,
162- } as Response ) ;
163-
164- const { getExperiments } = await import ( "./getExperiments" ) ;
165-
166- const result = await getExperiments ( {
167- experimentationId : "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" ,
168- locale : "en-US" ,
169- countryCode : "us" ,
170- } ) ;
171-
172- expect ( fetchMock ) . toHaveBeenCalledTimes ( 1 ) ;
173- const [ calledUrl ] = fetchMock . mock . calls [ 0 ] ;
174- expect ( calledUrl . toString ( ) ) . toBe (
175- "https://cirrus.example/base/v1/features" ,
176- ) ;
177-
178- expect ( result ) . toEqual ( { Features : featuresJson } ) ;
179- expect ( loggerMock . info ) . toHaveBeenCalledWith (
180- "Sending request to Cirrus" ,
181- expect . objectContaining ( {
182- serverUrl : "https://cirrus.example/base/v1/features" ,
183- previewMode : false ,
184- } ) ,
185- ) ;
186- } ) ;
187-
188152 it ( "fallsback to defaultExperimentData when not experiment data is returned by Cirrus" , async ( ) => {
189153 process . env . NIMBUS_SIDECAR_URL = "https://cirrus.example" ;
190154 headersMock . mockResolvedValue (
@@ -266,31 +230,4 @@ describe("getExperiments", () => {
266230 expect ( captureExceptionMock ) . toHaveBeenCalledTimes ( 1 ) ;
267231 expect ( result ) . toEqual ( defaultExperimentDataMock ) ;
268232 } ) ;
269-
270- it ( "logs error, captures exception, and returns defaultExperimentData on fetch throw" , async ( ) => {
271- process . env . NIMBUS_SIDECAR_URL = "https://cirrus.example/" ;
272- getEnabledFeatureFlagsMock . mockReturnValue ( [ ] as FeatureFlagName [ ] ) ;
273- headersMock . mockResolvedValue ( new Headers ( [ ] ) ) ;
274-
275- fetchMock . mockRejectedValue ( new Error ( "error" ) ) ;
276-
277- const { getExperiments } = await import ( "./getExperiments" ) ;
278-
279- const result = await getExperiments ( {
280- experimentationId : "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" ,
281- locale : "nl-NL" ,
282- countryCode : "nl" ,
283- } ) ;
284-
285- expect ( loggerMock . error ) . toHaveBeenCalledWith (
286- "Could not connect to Cirrus" ,
287- expect . objectContaining ( {
288- serverUrl : new URL ( "https://cirrus.example/v1/features" ) ,
289- previewMode : false ,
290- flags : [ ] ,
291- } ) ,
292- ) ;
293- expect ( captureExceptionMock ) . toHaveBeenCalledTimes ( 1 ) ;
294- expect ( result ) . toEqual ( defaultExperimentDataMock ) ;
295- } ) ;
296233} ) ;
0 commit comments