File q-brush.spec.js
has 657 lines of code (exceeds 250 allowed). Consider refactoring.
import qBrush, { extractFieldFromId } from '../q-brush';
describe('q-brush', () => {
let brush;
let layout;
Similar blocks of code found in 2 locations. Consider refactoring.
it('should have valid params if opts = { orMode: false }', () => {
const selections = qBrush(brush, { orMode: false });
expect(selections[0].params).to.eql([
'/qHyperCubeDef',
[
Similar blocks of code found in 2 locations. Consider refactoring.
it('should have valid params if opts = { orMode: true }', () => {
const selections = qBrush(brush, { orMode: true });
expect(selections[0].params).to.eql([
'/qHyperCubeDef',
[
Similar blocks of code found in 2 locations. Consider refactoring.
it('should get top dimension', () => {
layout.qHyperCube.qNoOfLeftDims = 0;
layout.qHyperCube.qEffectiveInterColumnSortOrder.push(1);
const selections = qBrush(
Similar blocks of code found in 2 locations. Consider refactoring.
it('should have valid params when primary is specified', () => {
layout.qHyperCube.qNoOfLeftDims = 1;
layout.qHyperCube.qEffectiveInterColumnSortOrder.push(1);
const selections = qBrush(
Identical blocks of code found in 2 locations. Consider refactoring.
expect(selections[0].params).to.eql([
'/layers/0/qHyperCubeDef',
[
{
qCol: 2,
Identical blocks of code found in 2 locations. Consider refactoring.
expect(selections[0].params).to.eql([
'/layers/0/qHyperCubeDef',
[
{
qCol: 2,
Similar blocks of code found in 3 locations. Consider refactoring.
beforeEach(() => {
brush.brushes.returns([
{
id: '/qHyperCube/qDimensionInfo/1',
type: 'range',
plugins/q/src/brush/__tests__/q-brush.spec.js on lines 60..80 Similar blocks of code found in 3 locations. Consider refactoring.
beforeEach(() => {
brush.brushes.returns([
{
id: '/qTreeData/qDimensionInfo/1/qMeasureInfo/2',
type: 'range',
plugins/q/src/brush/__tests__/q-brush.spec.js on lines 60..80 Similar blocks of code found in 3 locations. Consider refactoring.
beforeEach(() => {
brush.brushes.returns([
{
id: '/qHyperCube/qMeasureInfo/3',
type: 'range',
Identical blocks of code found in 2 locations. Consider refactoring.
brush.brushes.returns([
{
id: 'layers/0/qHyperCube/qDimensionInfo/2',
type: 'value',
brush: {
Identical blocks of code found in 2 locations. Consider refactoring.
brush.brushes.returns([
{
id: 'layers/0/qHyperCube/qDimensionInfo/2',
type: 'value',
brush: {
Similar blocks of code found in 2 locations. Consider refactoring.
it('should have method="selectPivotCells" when qMode="K"', () => {
layout.qHyperCube.qMode = 'K';
const selections = qBrush(brush, { byCells: true }, layout);
expect(selections[0].method).to.equal('selectPivotCells');
Similar blocks of code found in 2 locations. Consider refactoring.
it('should have method="selectPivotCells" when qMode="P"', () => {
layout.qHyperCube.qMode = 'P';
const selections = qBrush(brush, { byCells: true }, layout);
expect(selections[0].method).to.equal('selectPivotCells');
Similar blocks of code found in 7 locations. Consider refactoring.
it('should map attribute dimension layout value to params (on measure)', () => {
let v = extractFieldFromId('/qHyperCube/qMeasureInfo/2/qAttrDimInfo/4');
expect(v).to.eql({
path: '/qHyperCubeDef/qMeasures/2/qAttributeDimensions/4',
dimensionIdx: 0,
Similar blocks of code found in 7 locations. Consider refactoring.
it('should map attribute expression layout value to params (on dimension) - without layout', () => {
let v = extractFieldFromId('/qHyperCube/qDimensionInfo/1/qAttrExprInfo/1');
expect(v).to.eql({
path: '/qHyperCubeDef',
measureIdx: 1,
Similar blocks of code found in 7 locations. Consider refactoring.
it('should map attribute dimension column layout value to params (on measure)', () => {
let v = extractFieldFromId('qHyperCube/qMeasureInfo/2/qAttrDimInfo/4/3');
expect(v).to.eql({
path: '/qHyperCubeDef/qMeasures/2/qAttributeDimensions/4',
dimensionIdx: 3,
Similar blocks of code found in 7 locations. Consider refactoring.
it('should map attribute dimension layout value to params (on dimension)', () => {
let v = extractFieldFromId('/qHyperCube/qDimensionInfo/2/qAttrDimInfo/5');
expect(v).to.eql({
path: '/qHyperCubeDef/qDimensions/2/qAttributeDimensions/5',
dimensionIdx: 0,
Similar blocks of code found in 7 locations. Consider refactoring.
it('should map attribute expression layout value to params (on measure) - without layout', () => {
let v = extractFieldFromId('/qHyperCube/qMeasureInfo/1/qAttrExprInfo/1');
expect(v).to.eql({
path: '/qHyperCubeDef',
measureIdx: 3,
Similar blocks of code found in 7 locations. Consider refactoring.
it('should map attribute dimension column layout value to params (on dimension)', () => {
let v = extractFieldFromId('/qHyperCube/qDimensionInfo/2/qAttrDimInfo/5/3');
expect(v).to.eql({
path: '/qHyperCubeDef/qDimensions/2/qAttributeDimensions/5',
dimensionIdx: 3,
Similar blocks of code found in 7 locations. Consider refactoring.
it('should map dimension layout value to params', () => {
let v = extractFieldFromId('/qHyperCube/qDimensionInfo/3');
expect(v).to.eql({
path: '/qHyperCubeDef',
dimensionIdx: 3,
Similar blocks of code found in 4 locations. Consider refactoring.
it('should have method="rangeSelectHyperCubeValues"', () => {
const selections = qBrush(brush);
expect(selections[0].method).to.equal('rangeSelectHyperCubeValues');
});
plugins/q/src/brush/__tests__/q-brush.spec.js on lines 48..51 Similar blocks of code found in 4 locations. Consider refactoring.
it('should have method="selectHyperCubeContinuousRange"', () => {
const selections = qBrush(brush);
expect(selections[0].method).to.equal('selectHyperCubeContinuousRange');
});
plugins/q/src/brush/__tests__/q-brush.spec.js on lines 48..51 plugins/q/src/brush/__tests__/q-brush.spec.js on lines 82..85 Similar blocks of code found in 4 locations. Consider refactoring.
it('should have method="multiRangeSelectTreeDataValues"', () => {
const selections = qBrush(brush);
expect(selections[0].method).to.equal('multiRangeSelectTreeDataValues');
});
plugins/q/src/brush/__tests__/q-brush.spec.js on lines 48..51 plugins/q/src/brush/__tests__/q-brush.spec.js on lines 82..85 Similar blocks of code found in 4 locations. Consider refactoring.
it('should have method="selectHyperCubeValues"', () => {
const selections = qBrush(brush);
expect(selections[0].method).to.equal('selectHyperCubeValues');
});
plugins/q/src/brush/__tests__/q-brush.spec.js on lines 82..85 There are no issues that match your filters.