Skip to content

Commit

Permalink
Merge pull request VSCodeVim#150 from johnfn/clean-up-test
Browse files Browse the repository at this point in the history
Convert test to async/await style.
  • Loading branch information
jpoon committed Feb 18, 2016
2 parents 874f4da + 7a13224 commit b57af0d
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions test/mode/modeNormal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ suite("Mode Normal", () => {
let motion : Motion;
let modeNormal : NormalMode;

setup(() => {
return setupWorkspace().then(() => {
motion = new Motion(MotionMode.Cursor);
modeNormal = new NormalMode(motion);
});
setup(async () => {
await setupWorkspace();

motion = new Motion(MotionMode.Cursor);
modeNormal = new NormalMode(motion);
});

teardown(cleanUpWorkspace);
Expand All @@ -30,22 +30,13 @@ suite("Mode Normal", () => {
}
});

test("Can handle 'x'", () => {
return TextEditor.insert("text")
.then(() => {
motion = motion.moveTo(0, 2);
})
.then(() => {
return modeNormal.handleKeyEvent("x");
})
.then(() => {
return assertEqualLines(["tet"]);
})
.then(() => {
return modeNormal.handleKeyEvent("x");
})
.then(() => {
return assertEqualLines(["te"]);
});
test("Can handle 'x'", async () => {
await TextEditor.insert("text");

motion = motion.moveTo(0, 2);
await modeNormal.handleKeyEvent("x");
await assertEqualLines(["tet"]);
await modeNormal.handleKeyEvent("x");
assertEqualLines(["te"]);
});
});

0 comments on commit b57af0d

Please sign in to comment.