diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/VariableEditor/VariableEditor.test.tsx b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/VariableEditor/VariableEditor.test.tsx index 7ae4a0c5082..176766b6f69 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/VariableEditor/VariableEditor.test.tsx +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/VariableEditor/VariableEditor.test.tsx @@ -40,6 +40,20 @@ const defaultProps = { }), }; +const ARGqueryProps = { + ...defaultProps, + query: { + refId: 'A', + queryType: AzureQueryType.AzureResourceGraph, + azureResourceGraph: { + query: 'Resources | distinct type', + resultFormat: 'table', + }, + subscriptions: ['Subscription1', 'Subscription2'], + subscription: 'id', + }, +}; + describe('VariableEditor:', () => { it('can view a legacy Grafana query function', async () => { const onChange = jest.fn(); @@ -57,6 +71,7 @@ describe('VariableEditor:', () => { }) ); }); + describe('log queries:', () => { it('should render', async () => { render(); @@ -83,17 +98,8 @@ describe('VariableEditor:', () => { }); describe('Azure Resource Graph queries:', () => { - const ARGquery = { - refId: 'A', - queryType: AzureQueryType.AzureResourceGraph, - azureResourceGraph: { - query: 'Resources | distinct type', - }, - subscriptions: ['Subscription1', 'Subscription2'], - }; - it('should render', async () => { - render(); + render(); await waitFor(() => screen.queryByTestId('mockeditor')); expect(screen.queryByLabelText('Subscriptions')).toBeInTheDocument(); expect(screen.queryByLabelText('Select subscription')).not.toBeInTheDocument(); @@ -106,13 +112,14 @@ describe('VariableEditor:', () => { it('should call on change if the query changes', async () => { const onChange = jest.fn(); - render(); + render(); await waitFor(() => screen.queryByTestId('mockeditor')); expect(screen.queryByTestId('mockeditor')).toBeInTheDocument(); await userEvent.type(screen.getByTestId('mockeditor'), '{backspace}'); expect(onChange).toHaveBeenCalledWith({ - ...ARGquery, + ...ARGqueryProps.query, azureResourceGraph: { + ...ARGqueryProps.query.azureResourceGraph, query: 'Resources | distinct typ', }, });