more stable integration test: onDidOpenNotebookDocument

This commit is contained in:
Johannes Rieken 2021-06-29 08:25:47 +02:00
parent cc52823098
commit 84d21d968d
No known key found for this signature in database
GPG key ID: 96634B5AF12F8798

View file

@ -411,12 +411,14 @@ suite('Notebook Document', function () {
});
test('onDidOpenNotebookDocument - emit event only once when opened in two editors', async function () {
const uri = await utils.createRandomFile(undefined, undefined, '.nbdtest');
let counter = 0;
testDisposables.push(vscode.workspace.onDidOpenNotebookDocument(() => {
counter++;
testDisposables.push(vscode.workspace.onDidOpenNotebookDocument(nb => {
if (uri.toString() === nb.uri.toString()) {
counter++;
}
}));
const uri = await utils.createRandomFile(undefined, undefined, '.nbdtest');
const notebook = await vscode.workspace.openNotebookDocument(uri);
assert.strictEqual(counter, 1);