From 7a132243c2529e9622422fe9a72f90786ad0a38f Mon Sep 17 00:00:00 2001 From: johnfn Date: Wed, 17 Feb 2016 22:31:32 -0800 Subject: [PATCH] Convert test to async/await style. --- test/mode/modeNormal.test.ts | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/test/mode/modeNormal.test.ts b/test/mode/modeNormal.test.ts index 75a94cfbc24..5da24f04bc2 100644 --- a/test/mode/modeNormal.test.ts +++ b/test/mode/modeNormal.test.ts @@ -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); @@ -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"]); }); });