@@ -8,12 +8,14 @@ import { Tooltip } from '../../ui';
88jest . mock ( '../../editor' , ( ) => {
99 const mockedSetQueryEditor = jest . fn ( ) ;
1010 const mockedSetVariableEditor = jest . fn ( ) ;
11+ const mockedSetExtensionEditor = jest . fn ( ) ;
1112 const mockedSetHeaderEditor = jest . fn ( ) ;
1213 return {
1314 useEditorContext ( ) {
1415 return {
1516 queryEditor : { setValue : mockedSetQueryEditor } ,
1617 variableEditor : { setValue : mockedSetVariableEditor } ,
18+ extensionEditor : { setValue : mockedSetExtensionEditor } ,
1719 headerEditor : { setValue : mockedSetHeaderEditor } ,
1820 } ;
1921 } ,
@@ -30,6 +32,8 @@ const mockQuery = /* GraphQL */ `
3032
3133const mockVariables = JSON . stringify ( { string : 'string' } ) ;
3234
35+ const mockExtensions = JSON . stringify ( { myExtension : 'myString' } ) ;
36+
3337const mockHeaders = JSON . stringify ( { foo : 'bar' } ) ;
3438
3539const mockOperationName = 'Test' ;
@@ -50,6 +54,7 @@ const baseMockProps: QueryHistoryItemProps = {
5054 item : {
5155 query : mockQuery ,
5256 variables : mockVariables ,
57+ extensions : mockExtensions ,
5358 headers : mockHeaders ,
5459 favorite : false ,
5560 } ,
@@ -70,11 +75,14 @@ describe('QueryHistoryItem', () => {
7075 ?. setValue as jest . Mock ;
7176 const mockedSetVariableEditor = useEditorContext ( ) ?. variableEditor
7277 ?. setValue as jest . Mock ;
78+ const mockedSetExtensionEditor = useEditorContext ( ) ?. extensionEditor
79+ ?. setValue as jest . Mock ;
7380 const mockedSetHeaderEditor = useEditorContext ( ) ?. headerEditor
7481 ?. setValue as jest . Mock ;
7582 beforeEach ( ( ) => {
7683 mockedSetQueryEditor . mockClear ( ) ;
7784 mockedSetVariableEditor . mockClear ( ) ;
85+ mockedSetExtensionEditor . mockClear ( ) ;
7886 mockedSetHeaderEditor . mockClear ( ) ;
7987 } ) ;
8088 it ( 'renders operationName if label is not provided' , ( ) => {
@@ -112,6 +120,10 @@ describe('QueryHistoryItem', () => {
112120 expect ( mockedSetVariableEditor ) . toHaveBeenCalledWith (
113121 mockProps . item . variables ,
114122 ) ;
123+ expect ( mockedSetExtensionEditor ) . toHaveBeenCalledTimes ( 1 ) ;
124+ expect ( mockedSetExtensionEditor ) . toHaveBeenCalledWith (
125+ mockProps . item . extensions ,
126+ ) ;
115127 expect ( mockedSetHeaderEditor ) . toHaveBeenCalledTimes ( 1 ) ;
116128 expect ( mockedSetHeaderEditor ) . toHaveBeenCalledWith ( mockProps . item . headers ) ;
117129 } ) ;
0 commit comments