mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 03:54:24 +01:00
api tests - more use of promises in mocha
This commit is contained in:
@@ -14,12 +14,10 @@ import {join} from 'path';
|
||||
|
||||
suite("editor tests", () => {
|
||||
|
||||
teardown((done) => {
|
||||
cleanUp().then(() => done(), (error) => done(error));
|
||||
});
|
||||
teardown(cleanUp);
|
||||
|
||||
test('make edit', (done) => {
|
||||
createRandomFile().then(file => {
|
||||
test('make edit', () => {
|
||||
return createRandomFile().then(file => {
|
||||
return workspace.openTextDocument(file).then(doc => {
|
||||
return window.showTextDocument(doc).then((editor) => {
|
||||
return editor.edit((builder) => {
|
||||
@@ -38,6 +36,6 @@ suite("editor tests", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
}).then(() => done(), (error) => done(error));
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -12,17 +12,15 @@ import {cleanUp} from './utils';
|
||||
|
||||
suite("window namespace tests", () => {
|
||||
|
||||
teardown((done) => {
|
||||
cleanUp().then(() => done(), (error) => done(error));
|
||||
});
|
||||
teardown(cleanUp);
|
||||
|
||||
test('active text editor', (done) => {
|
||||
workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => {
|
||||
test('active text editor', () => {
|
||||
return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => {
|
||||
return window.showTextDocument(doc).then((editor) => {
|
||||
const active = window.activeTextEditor;
|
||||
assert.ok(active);
|
||||
assert.equal(active.document.uri.fsPath, doc.uri.fsPath);
|
||||
});
|
||||
}).then(() => done(), (error) => done(error));
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -40,8 +40,8 @@ suite('workspace-namespace', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('events: onDidOpenTextDocument, onDidChangeTextDocument, onDidSaveTextDocument', (done) => {
|
||||
createRandomFile().then(file => {
|
||||
test('events: onDidOpenTextDocument, onDidChangeTextDocument, onDidSaveTextDocument', () => {
|
||||
return createRandomFile().then(file => {
|
||||
let disposables = [];
|
||||
|
||||
let onDidOpenTextDocument = false;
|
||||
@@ -81,17 +81,13 @@ suite('workspace-namespace', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
}).then(() => done(), (error) => done(error));
|
||||
});
|
||||
});
|
||||
|
||||
test('findFiles', done => {
|
||||
workspace.findFiles('*.js', null).then((res) => {
|
||||
test('findFiles', () => {
|
||||
return workspace.findFiles('*.js', null).then((res) => {
|
||||
assert.equal(res.length, 1);
|
||||
assert.equal(workspace.asRelativePath(res[0]), '/far.js');
|
||||
|
||||
done();
|
||||
}, err => {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user