-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
index.spec.js
32 lines (28 loc) · 1.19 KB
/
index.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import test from 'tape-catch';
function getDeckModel(state) {
// Require at runtime, after the environment is polyfilled
const {DeckGLModel} = require('@deck.gl/jupyter-widget');
const {createTestModel} = require('./utils.spec');
const model = createTestModel(DeckGLModel, state);
return model;
}
test('jupyter-widget should be createable', t => {
const model = getDeckModel({});
t.equal(model.get('json_input'), null, 'json_input should be null');
t.equal(model.get('mapbox_key'), null, 'mapbox_key should be null');
t.equal(model.get('width'), 500, 'default width should be specified');
t.equal(model.get('height'), 500, 'default height should be specified');
t.end();
});
test('jupyter-widget should be creatable with a value', t => {
const state = {
mapbox_key: 'fake-key',
json_input: '{mock_input: 1}'
};
const model = getDeckModel(state);
t.equal(model.get('json_input'), state.json_input, 'json_input should be pre-configured');
t.equal(model.get('mapbox_key'), state.mapbox_key, 'mapbox_key should be pre-configured');
t.equal(model.get('width'), 500, 'width should be the default');
t.equal(model.get('height'), 500, 'height should be the default');
t.end();
});