Skip to content

Commit

Permalink
add API test for onDidExecuteCommand, #1431
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Jul 24, 2019
1 parent 6a25cfa commit 5d8bd62
Showing 1 changed file with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,31 @@ suite('commands namespace tests', () => {

return Promise.all([a, b, c, d]);
});
});

test('onDidExecuteCommand', async function () {
let args: any[];
let d1 = commands.registerCommand('t1', function () {
args = [...arguments];
});


const p = new Promise((resolve, reject) => {

let d2 = commands.onDidExecuteCommand(event => {
d2.dispose();
d1.dispose();

try {
assert.equal(event.command, 't1');
assert.deepEqual(args, event.arguments);
resolve();
} catch (e) {
reject(e);
}
});
});

await commands.executeCommand('t1', { foo: 1 });
await p;
});
});

0 comments on commit 5d8bd62

Please sign in to comment.