From 44447c0ca0d10e934bda4dfc2bce49ca914aedac Mon Sep 17 00:00:00 2001 From: Alex Spencer <52186778+alexjonspencer1@users.noreply.github.com> Date: Mon, 5 May 2025 14:58:45 -0600 Subject: [PATCH] Dashboards testing: Update failing test (#104966) fix: update dashboards test --- public/app/plugins/datasource/dashboard/datasource.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/app/plugins/datasource/dashboard/datasource.test.ts b/public/app/plugins/datasource/dashboard/datasource.test.ts index 76412500540..26413c094df 100644 --- a/public/app/plugins/datasource/dashboard/datasource.test.ts +++ b/public/app/plugins/datasource/dashboard/datasource.test.ts @@ -108,12 +108,15 @@ describe('DashboardDatasource', () => { }); it('Should not mutate field state in dataframe', () => { + jest.useFakeTimers(); const { observable } = setup({ refId: 'A', panelId: 1, withTransforms: true }); let rsp: DataQueryResponse | undefined; const test = observable.subscribe({ next: (data) => (rsp = data) }); + jest.runAllTimers(); + // modifying series in dashboard DS should not affect the original dataframe rsp!.data[0].fields[0].state = { calcs: { sum: 3 }, @@ -123,6 +126,8 @@ describe('DashboardDatasource', () => { observable.subscribe({ next: (data) => (rsp = data) }); + jest.runAllTimers(); + // on further emissions the result should be the unmodified original dataframe expect(rsp!.data[0].fields[0].state).toEqual({}); });