Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ba63624

Browse files
committed
test: add test cases for category + array target + interval op
1 parent 2897167 commit ba63624

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

test/jasmine/tests/transform_filter_test.js

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ describe('filter transforms calc:', function() {
653653
expect(out[0].transforms[0].target).toEqual(['b', 'b', 'b']);
654654
});
655655

656-
it('with categorical items and *<* & *>=*', function() {
656+
it('with categorical items and *<* and *>=*', function() {
657657
var out = _transform([{
658658
x: [1, 2, 3],
659659
y: [10, 20, 30],
@@ -683,6 +683,62 @@ describe('filter transforms calc:', function() {
683683
expect(out[1].transforms[0].target).toEqual(['b', 'c']);
684684
});
685685

686+
it('with categorical items and *[]*, *][*, *()* and *)(*', function() {
687+
var out = _transform([{
688+
x: [1, 2, 3],
689+
y: [10, 20, 30],
690+
transforms: [{
691+
type: 'filter',
692+
operation: '[]',
693+
target: ['a', 'b', 'c'],
694+
value: ['a', 'b']
695+
}]
696+
}, {
697+
x: [1, 2, 3],
698+
y: [10, 20, 30],
699+
transforms: [{
700+
type: 'filter',
701+
operation: '()',
702+
target: ['a', 'b', 'c'],
703+
value: ['a', 'b']
704+
}]
705+
}, {
706+
x: [1, 2, 3],
707+
y: [30, 20, 10],
708+
transforms: [{
709+
type: 'filter',
710+
operation: '][',
711+
target: ['a', 'b', 'c'],
712+
value: ['a', 'b']
713+
}]
714+
}, {
715+
x: [1, 2, 3],
716+
y: [30, 20, 10],
717+
transforms: [{
718+
type: 'filter',
719+
operation: ')(',
720+
target: ['a', 'b', 'c'],
721+
value: ['a', 'b']
722+
}]
723+
}]);
724+
725+
expect(out[0].x).toEqual([1, 2]);
726+
expect(out[0].y).toEqual([10, 20]);
727+
expect(out[0].transforms[0].target).toEqual(['a', 'b']);
728+
729+
expect(out[1].x).toEqual([]);
730+
expect(out[1].y).toEqual([]);
731+
expect(out[1].transforms[0].target).toEqual([]);
732+
733+
expect(out[2].x).toEqual([1, 2, 3]);
734+
expect(out[2].y).toEqual([30, 20, 10]);
735+
expect(out[2].transforms[0].target).toEqual(['a', 'b', 'c']);
736+
737+
expect(out[3].x).toEqual([3]);
738+
expect(out[3].y).toEqual([10]);
739+
expect(out[3].transforms[0].target).toEqual(['c']);
740+
});
741+
686742
it('with dates items', function() {
687743
var out = _transform([Lib.extendDeep({}, _base, {
688744
transforms: [{

0 commit comments

Comments
 (0)