mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-07 03:24:04 -04:00
Add tests and update core example to handle stage being undefined.
This commit is contained in:
parent
0e710ba3d9
commit
30c9b7fd84
3 changed files with 68 additions and 17 deletions
test/unit
|
@ -62,3 +62,24 @@ test('remote', t => {
|
|||
.then(() => runServiceTest('RemoteDispatchTest', t), e => t.fail(e))
|
||||
.then(() => dispatch._remoteCall(worker, 'dispatch', 'terminate'), e => t.fail(e));
|
||||
});
|
||||
|
||||
test('local, sync', t => {
|
||||
dispatch.setServiceSync('SyncDispatchTest', new DispatchTestService());
|
||||
|
||||
const a = dispatch.callSync('SyncDispatchTest', 'returnFortyTwo');
|
||||
t.equal(a, 42);
|
||||
|
||||
const b = dispatch.callSync('SyncDispatchTest', 'doubleArgument', 9);
|
||||
t.equal(b, 18);
|
||||
|
||||
const c = dispatch.callSync('SyncDispatchTest', 'doubleArgument', 123);
|
||||
t.equal(c, 246);
|
||||
|
||||
try {
|
||||
dispatch.callSync('SyncDispatchTest', 'throwException');
|
||||
} catch (e) {
|
||||
t.equal(e.message, 'This is a test exception thrown by DispatchTest');
|
||||
}
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue