Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Fixing flaky unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Dec 30, 2016
1 parent 0505f2a commit 7ea8bb1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions test/go.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ suite('Go Extension Tests', () => {
fs.copySync(path.join(fixtureSourcePath, 'generatetests', 'generatetests.go'), path.join(generateTestsSourcePath, 'generatetests.go'));
fs.copySync(path.join(fixtureSourcePath, 'generatetests', 'generatetests.go'), path.join(generateFunctionTestSourcePath, 'generatetests.go'));
fs.copySync(path.join(fixtureSourcePath, 'generatetests', 'generatetests.go'), path.join(generatePackageTestSourcePath, 'generatetests.go'));
fs.copySync(path.join(fixtureSourcePath, 'diffTestData', 'file1.go'), path.join(fixturePath, 'diffTest1Data', 'file1.go'));
fs.copySync(path.join(fixtureSourcePath, 'diffTestData', 'file2.go'), path.join(fixturePath, 'diffTest1Data', 'file2.go'));
fs.copySync(path.join(fixtureSourcePath, 'diffTestData', 'file1.go'), path.join(fixturePath, 'diffTest2Data', 'file1.go'));
fs.copySync(path.join(fixtureSourcePath, 'diffTestData', 'file2.go'), path.join(fixturePath, 'diffTest2Data', 'file2.go'));
});

suiteTeardown(() => {
Expand Down Expand Up @@ -406,8 +410,8 @@ It returns the number of bytes written and any write error encountered.
});

test('Test diffUtils.getEditsFromUnifiedDiffStr', (done) => {
let file1path = path.join(fixtureSourcePath, 'diffTestData', 'file1.go');
let file2path = path.join(fixtureSourcePath, 'diffTestData', 'file2.go');
let file1path = path.join(fixturePath, 'diffTest1Data', 'file1.go');
let file2path = path.join(fixturePath, 'diffTest1Data', 'file2.go');
let file1uri = vscode.Uri.file(file1path);
let file2contents = fs.readFileSync(file2path, 'utf8');

Expand Down Expand Up @@ -443,16 +447,16 @@ It returns the number of bytes written and any write error encountered.
});
}).then(() => {
assert.equal(editor.document.getText(), file2contents);
return vscode.commands.executeCommand('workbench.action.files.revert');
return Promise.resolve();
});
});
});
}).then(() => done(), done);
});

test('Test diffUtils.getEdits', (done) => {
let file1path = path.join(fixtureSourcePath, 'diffTestData', 'file1.go');
let file2path = path.join(fixtureSourcePath, 'diffTestData', 'file2.go');
let file1path = path.join(fixturePath, 'diffTest2Data', 'file1.go');
let file2path = path.join(fixturePath, 'diffTest2Data', 'file2.go');
let file1uri = vscode.Uri.file(file1path);
let file1contents = fs.readFileSync(file1path, 'utf8');
let file2contents = fs.readFileSync(file2path, 'utf8');
Expand Down Expand Up @@ -485,7 +489,7 @@ It returns the number of bytes written and any write error encountered.
});
}).then(() => {
assert.equal(editor.document.getText(), file2contents);
return vscode.commands.executeCommand('workbench.action.files.revert');
return Promise.resolve();
});
}).then(() => done(), done);
});
Expand Down

0 comments on commit 7ea8bb1

Please sign in to comment.