Unit test failing with 'TypeError: onBeforeUpdate is not a function' #5219
Replies: 4 comments 1 reply
-
Does it work if you add this? generateLayerTests({..., onBeforeUpdate: () => {}}); |
Beta Was this translation helpful? Give feedback.
-
Hi, Thank you for your reply. tried to include it in my code. 'generateLayerTests({..., onBeforeUpdate: () => {}});' const testCases = generateLayerTests({
}); t.end(); FAIL src/App.test.js
Test Suites: 1 failed, 1 total |
Beta Was this translation helpful? Give feedback.
-
That's not valid JavaScript. I meant adding |
Beta Was this translation helpful? Give feedback.
-
Added a default for |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm trying to run a simple unit test and it is failing with "TypeError: onBeforeUpdate is not a function".
Can you please let me know if there is some issue with my code that is causing this issue. I have tried with a blank data too to check if thee is some issue with my data itself. But, getting the same issue.
Thank you,
App.test.js
import test from 'tape-catch';
import {testLayer, generateLayerTests} from '@deck.gl/test-utils';
import {GeoJsonLayer} from '@deck.gl/layers';
test('GeoJsonLayer#tests', t => {
const testCases = generateLayerTests({
Layer: GeoJsonLayer,
sampleProps: {
data: [{
"id": "track1",
"type": "track",
"path": [
[0, 0],
[60, 0]
],
"status": "vacant",
"direction": "S",
"show": 1
}]
},
assert: ({layer, subLayers}) => {
//t.ok(layer.state.features, 'should update features');
//t.is(subLayers.length, layer.props.stroked ? 2 : 1, 'correct number of sublayers');
t.is(1, 1, "GOOODDD!!!!!!!!!!!!!");
}
});
testLayer({Layer: GeoJsonLayer, testCases});
t.end();
});
After running 'npm test', this is the error I'm getting.
RUNS src/App.test.js
TAP version 13
GeoJsonLayer#tests
ok 1 GOOODDD!!!!!!!!!!!!!
not ok 2 TypeError: onBeforeUpdate is not a function
FAIL src/App.test.jsmediate (internal/timers.js:461:21)
● Test suite failed to run
console.log
deck: deck.gl 8.3.6 - set deck.log.level=1 (or higher) to trace attribute updates
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 9.779 s
Ran all test suites related to changed files.
Beta Was this translation helpful? Give feedback.
All reactions