Skip to content

Commit 22af04d

Browse files
committed
test: fix the types of the tests
1 parent 0909dce commit 22af04d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

spec/CodeFormatManager-spec.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Range } from "atom"
1+
import { Range, TextEditor } from "atom"
22
import { observeTextEditors } from "@atom-ide-community/nuclide-commons-atom/FileEventHandlers"
33
import CodeFormatManager, { SAVE_TIMEOUT } from "../src/CodeFormatManager"
44
import UniversalDisposable from "@atom-ide-community/nuclide-commons/UniversalDisposable"
@@ -8,17 +8,17 @@ import { waitFor, sleep } from "./utils"
88

99
jasmine.DEFAULT_TIMEOUT_INTERVAL = SAVE_TIMEOUT + 100
1010
describe("CodeFormatManager", () => {
11-
let textEditor
12-
let manager
13-
let disposables
11+
let textEditor: TextEditor
12+
let manager: CodeFormatManager
13+
let disposables: UniversalDisposable
1414
beforeEach(async () => {
1515
manager = new CodeFormatManager()
1616
disposables = new UniversalDisposable(observeTextEditors())
1717
temp.track()
1818
const file = temp.openSync()
1919
textEditor = await atom.workspace.open(file.path)
2020
})
21-
afterEach(async () => {
21+
afterEach(() => {
2222
manager.dispose()
2323
disposables.dispose()
2424
})
@@ -36,7 +36,7 @@ describe("CodeFormatManager", () => {
3636
]),
3737
})
3838
textEditor.setText("abc")
39-
atom.commands.dispatch(atom.views.getView(textEditor), "code-format:format-code")
39+
await atom.commands.dispatch(atom.views.getView(textEditor), "code-format:format-code")
4040
await waitFor(() => textEditor.getText() === "def")
4141
})
4242
it("format an editor using formatEntireFile", async () => {
@@ -49,7 +49,7 @@ describe("CodeFormatManager", () => {
4949
}),
5050
})
5151
textEditor.setText("abc")
52-
atom.commands.dispatch(atom.views.getView(textEditor), "code-format:format-code")
52+
await atom.commands.dispatch(atom.views.getView(textEditor), "code-format:format-code")
5353
await waitFor(() => textEditor.getText() === "ghi")
5454
})
5555
it("formats an editor on type", async () => {
@@ -106,6 +106,7 @@ describe("CodeFormatManager", () => {
106106
},
107107
})
108108
const spy = spyOn(textEditor.getBuffer(), "save")
109+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
109110
textEditor.save()
110111
// Wait until the buffer has been saved and verify it has been saved exactly
111112
// once.

0 commit comments

Comments
 (0)