-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ranking to make spec return [ ] if answerSet is empty (#183)
- Loading branch information
1 parent
c64e853
commit f91dc68
Showing
3 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {Channel} from 'vega-lite/src/channel'; | ||
import {Mark} from 'vega-lite/src/mark'; | ||
import {Type} from 'vega-lite/src/type'; | ||
|
||
|
||
import {schema} from '../fixture'; | ||
import {rank} from '../../src/ranking/ranking'; | ||
|
||
import {SpecQueryModelGroup} from '../../src/modelgroup'; | ||
|
||
import {assert} from 'chai'; | ||
|
||
|
||
describe('ranking', () => { | ||
describe('rank', () => { | ||
it('should return an empty group if the input group is empty', () => { | ||
let group: SpecQueryModelGroup = rank( | ||
{name: '', path: '', items: []}, | ||
{ | ||
spec: { | ||
mark: Mark.BAR, | ||
encodings: [ | ||
{channel: Channel.SHAPE, field: 'N', type: Type.NOMINAL}, | ||
] | ||
}, | ||
chooseBy: 'effectiveness' | ||
}, | ||
schema, | ||
0 | ||
); | ||
assert.deepEqual(group.items, []); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters