Files
superset2/superset/assets/spec/javascripts/dashboard/reducers_spec.js
Maxime Beauchemin c0db6dbb57 Moving some JS folders (#4820)
* Moving folders

* Pointing to new locations
2018-04-17 21:05:01 -07:00

36 lines
1.2 KiB
JavaScript

import { describe, it } from 'mocha';
import { expect } from 'chai';
import { dashboard as reducers } from '../../../src/dashboard/reducers';
import * as actions from '../../../src/dashboard/actions';
import { defaultFilters, dashboard as initState } from './fixtures';
describe('Dashboard reducers', () => {
it('should remove slice', () => {
const action = {
type: actions.REMOVE_SLICE,
slice: initState.dashboard.slices[1],
};
expect(initState.dashboard.slices).to.have.length(3);
const { dashboard, filters, refresh } = reducers(initState, action);
expect(dashboard.slices).to.have.length(2);
expect(filters).to.deep.equal(defaultFilters);
expect(refresh).to.equal(false);
});
it('should remove filter slice', () => {
const action = {
type: actions.REMOVE_SLICE,
slice: initState.dashboard.slices[0],
};
const initFilters = Object.keys(initState.filters);
expect(initFilters).to.have.length(2);
const { dashboard, filters, refresh } = reducers(initState, action);
expect(dashboard.slices).to.have.length(2);
expect(Object.keys(filters)).to.have.length(1);
expect(refresh).to.equal(true);
});
});