Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable unit tests for canvas-based layers (#3226)
- Loading branch information
1 parent
a4d1634
commit 0e679cc
Showing
9 changed files
with
142 additions
and
75 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
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,26 @@ | ||
import test from 'tape-catch'; | ||
import {Deck} from '@deck.gl/core'; | ||
import {_JSONConverter as JSONConverter} from '@deck.gl/json'; | ||
|
||
import {configuration, JSON_DATA} from './json-converter.spec'; | ||
|
||
test('JSONConverter#render', t => { | ||
const jsonConverter = new JSONConverter({configuration}); | ||
t.ok(jsonConverter, 'JSONConverter created'); | ||
|
||
const deckProps = jsonConverter.convertJsonToDeckProps(JSON_DATA); | ||
t.ok(deckProps, 'JSONConverter converted correctly'); | ||
|
||
const jsonDeck = new Deck( | ||
Object.assign( | ||
{ | ||
onAfterRender: () => { | ||
t.ok(jsonDeck, 'JSONConverter rendered'); | ||
jsonDeck.finalize(); | ||
t.end(); | ||
} | ||
}, | ||
deckProps | ||
) | ||
); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import test from 'tape-catch'; | ||
|
||
import {TextLayer} from '@deck.gl/layers'; | ||
import * as FIXTURES from 'deck.gl-test/data'; | ||
import {testLayer, generateLayerTests} from '@deck.gl/test-utils'; | ||
|
||
test('TextLayer', t => { | ||
const testCases = generateLayerTests({ | ||
Layer: TextLayer, | ||
sampleProps: { | ||
data: FIXTURES.points, | ||
getText: d => d.ADDRESS, | ||
getPosition: d => d.COORDINATES | ||
}, | ||
assert: t.ok, | ||
onBeforeUpdate: ({testCase}) => t.comment(testCase.title), | ||
onAfterUpdate: ({layer, subLayer}) => { | ||
if (layer.props.data.length) { | ||
t.ok(layer.state.data.length, 'Creates sublayer data'); | ||
t.ok(subLayer, 'Renders sublayer'); | ||
} | ||
} | ||
}); | ||
testLayer({Layer: TextLayer, testCases, onError: t.notOk}); | ||
|
||
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