Dashboards testing: Update failing test (#104966)

fix: update dashboards test
pull/104327/head^2
Alex Spencer 2 weeks ago committed by GitHub
parent cab241fbb6
commit 44447c0ca0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      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({});
});

Loading…
Cancel
Save