@@ -34,6 +34,12 @@ const wrapper: React.FC<React.PropsWithChildren> = ({ children }) => (
3434 uri : "https://dummyjson.com/products?skip=${skip}&limit=${limit}" ,
3535 inputs : [ "skip" , "limit" ] ,
3636 } ,
37+ {
38+ name : "getDummyUser" ,
39+ method : "GET" ,
40+ uri : "https://randomuser.me/api/?results=1" ,
41+ cacheExpirySeconds : 120 ,
42+ } ,
3743 ] ,
3844 } }
3945 >
@@ -111,6 +117,37 @@ test("call ensemble.invokeAPI", async () => {
111117 expect ( execResult ) . toBe ( apiConfig . limit ) ;
112118} ) ;
113119
120+ test ( "call ensemble.invokeAPI with bypassCache" , async ( ) => {
121+ const { result : withoutForce } = renderHook (
122+ ( ) =>
123+ useExecuteCode (
124+ "ensemble.invokeAPI('getDummyUser', null).then((res) => res.body.results[0].email)" ,
125+ ) ,
126+ { wrapper } ,
127+ ) ;
128+
129+ const { result : withForce } = renderHook (
130+ ( ) =>
131+ useExecuteCode (
132+ "ensemble.invokeAPI('getDummyUser', null, { bypassCache: true }).then((res) => res.body.results[0].email)" ,
133+ ) ,
134+ { wrapper } ,
135+ ) ;
136+
137+ let withoutForceInitialResult ;
138+ let withoutForceResult ;
139+ let withForceResult ;
140+
141+ await act ( async ( ) => {
142+ withoutForceInitialResult = await withoutForce . current ?. callback ( ) ;
143+ withoutForceResult = await withoutForce . current ?. callback ( ) ;
144+ withForceResult = await withForce . current ?. callback ( ) ;
145+ } ) ;
146+
147+ expect ( withoutForceInitialResult ) . toBe ( withoutForceResult ) ;
148+ expect ( withForceResult ) . not . toBe ( withoutForceResult ) ;
149+ } ) ;
150+
114151test . todo ( "populates application invokables" ) ;
115152
116153test . todo ( "resolves values in order of scoping" ) ;
0 commit comments