mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* Initial schema - Add types based off of current frontend * Rename and field-level comments * Update report and regenerate files * Rename frontend Azure folder - Doing this for consistency and to ensure code-generation works - Update betterer results due to file renames * Remove default and add back enum vals that I deleted * Set workspace prop as optional * Replace template variable types * Connect frontend query types - Keep properties optional for now to avoid major changes - Rename AzureMetricResource - Correctly use ResultFormat * Add TSVeneer decorator * Update schema * Update type * Update CODEOWNERS * Fix gen-cue issue * Fix backend test * Fix e2e test * Update code coverage * Remove references to old Azure Monitor path * Review * Regen files
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import { DashboardLoadedEvent } from '@grafana/data';
|
|
import { reportInteraction } from '@grafana/runtime';
|
|
import './module';
|
|
|
|
jest.mock('@grafana/runtime', () => {
|
|
return {
|
|
...jest.requireActual('@grafana/runtime'),
|
|
reportInteraction: jest.fn(),
|
|
getAppEvents: () => ({
|
|
subscribe: jest.fn((e, handler) => {
|
|
// Trigger test event
|
|
handler(
|
|
new DashboardLoadedEvent({
|
|
dashboardId: 'dashboard123',
|
|
orgId: 1,
|
|
userId: 2,
|
|
grafanaVersion: 'v9.0.0',
|
|
queries: {
|
|
'grafana-azure-monitor-datasource': [
|
|
{ queryType: 'Azure Monitor', hide: false },
|
|
{ queryType: 'Azure Log Analytics', hide: false },
|
|
{ queryType: 'Azure Resource Graph', hide: true },
|
|
{ queryType: 'Azure Monitor', hide: false },
|
|
],
|
|
},
|
|
})
|
|
);
|
|
}),
|
|
}),
|
|
};
|
|
});
|
|
|
|
describe('queriesOnInitDashboard', () => {
|
|
it('should report a `grafana_ds_azuremonitor_dashboard_loaded` interaction ', () => {
|
|
// subscribeDashboardLoadedEvent();
|
|
expect(reportInteraction).toHaveBeenCalledWith('grafana_ds_azuremonitor_dashboard_loaded', {
|
|
dashboard_id: 'dashboard123',
|
|
grafana_version: 'v9.0.0',
|
|
org_id: 1,
|
|
azure_monitor_queries: 2,
|
|
azure_log_analytics_queries: 1,
|
|
azure_resource_graph_queries: 0,
|
|
azure_monitor_queries_hidden: 0,
|
|
azure_log_analytics_queries_hidden: 0,
|
|
azure_resource_graph_queries_hidden: 1,
|
|
});
|
|
});
|
|
});
|