-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #417 from Kitware/fix-vega-dates
Fix date handling by using read() instead of inferAll() in axis logic
- Loading branch information
Showing
4 changed files
with
31 additions
and
9 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
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 |
---|---|---|
@@ -1,14 +1,27 @@ | ||
import test from 'tape-catch'; | ||
import { inferAll } from '..'; | ||
import { read } from 'datalib'; | ||
import { inferAll, read } from '..'; | ||
import dl from 'datalib'; | ||
|
||
test('inferAll()', t => { | ||
t.deepEqual(inferAll([{'a.b': 1}]), {'a.b': 'integer'}, 'should work on fields with nested dots'); | ||
t.deepEqual(inferAll([{'a': {'b': 1}}]), {'a': 'string'}, 'should only accept top-level fields'); | ||
|
||
let testData = [{a: 1, b: 'foo', c: 1.5}]; | ||
read(testData, {parse: 'auto'}); | ||
t.deepEqual(testData.__types__, inferAll(testData), 'should work identically to datalib read() when no nested dots'); | ||
t.deepEqual(dl.type.inferAll(testData), inferAll(testData), 'should work identically to datalib inferAll() when no nested dots'); | ||
|
||
t.end(); | ||
}); | ||
|
||
test('read()', t => { | ||
let testData = [{'a.b': 1}]; | ||
read(testData); | ||
t.deepEqual({'a.b': 'integer'}, testData.__types__, 'should work on fields with nested dots'); | ||
|
||
let testData1 = [{a: 1, b: 'foo', c: 1.5}]; | ||
let testData2 = [{a: 1, b: 'foo', c: 1.5}]; | ||
dl.read(testData1, {parse: 'auto'}); | ||
read(testData2); | ||
t.deepEqual(testData1.__types__, testData2.__types__, 'should work identically to datalib read() when no nested dots'); | ||
|
||
t.end(); | ||
}); |
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