@@ -182,6 +182,67 @@ describe('CacheLandingPage', function () {
182182 ) ;
183183 } ) ;
184184
185+ it ( 'should escape quote in transaction name' , async function ( ) {
186+ requestMocks . spanTransactionList . mockClear ( ) ;
187+ requestMocks . spanTransactionList = MockApiClient . addMockResponse ( {
188+ url : `/organizations/${ organization . slug } /events/` ,
189+ method : 'GET' ,
190+ match : [
191+ MockApiClient . matchQuery ( {
192+ referrer : 'api.performance.cache.landing-cache-transaction-list' ,
193+ } ) ,
194+ ] ,
195+ body : {
196+ data : [
197+ {
198+ transaction : 'transaction with "quote"' ,
199+ project : 'backend' ,
200+ 'project.id' : 123 ,
201+ 'avg(cache.item_size)' : 123 ,
202+ 'spm()' : 123 ,
203+ 'sum(span.self_time)' : 123 ,
204+ 'cache_miss_rate()' : 0.123 ,
205+ 'time_spent_percentage()' : 0.123 ,
206+ } ,
207+ ] ,
208+ meta : {
209+ fields : {
210+ transaction : 'string' ,
211+ project : 'string' ,
212+ 'project.id' : 'integer' ,
213+ 'avg(cache.item_size)' : 'number' ,
214+ 'spm()' : 'rate' ,
215+ 'sum(span.self_time)' : 'duration' ,
216+ 'cache_miss_rate()' : 'percentage' ,
217+ 'time_spent_percentage()' : 'percentage' ,
218+ } ,
219+ units : { } ,
220+ } ,
221+ } ,
222+ } ) ;
223+
224+ render ( < CacheLandingPage /> , { organization} ) ;
225+
226+ await waitForElementToBeRemoved ( ( ) => screen . queryAllByTestId ( 'loading-indicator' ) ) ;
227+
228+ expect ( requestMocks . transactionDurations ) . toHaveBeenCalledWith (
229+ `/organizations/${ organization . slug } /events/` ,
230+ expect . objectContaining ( {
231+ method : 'GET' ,
232+ query : {
233+ dataset : 'metrics' ,
234+ environment : [ ] ,
235+ field : [ 'avg(transaction.duration)' , 'transaction' ] ,
236+ per_page : 50 ,
237+ project : [ ] ,
238+ query : 'transaction:["transaction with \\"quote\\""]' ,
239+ referrer : 'api.performance.cache.landing-cache-transaction-duration' ,
240+ statsPeriod : '10d' ,
241+ } ,
242+ } )
243+ ) ;
244+ } ) ;
245+
185246 it ( 'renders a list of transactions' , async function ( ) {
186247 render ( < CacheLandingPage /> , { organization} ) ;
187248 await waitForElementToBeRemoved ( ( ) => screen . queryAllByTestId ( 'loading-indicator' ) ) ;
0 commit comments