1
- import { Range } from "atom"
1
+ import { Range , TextEditor } from "atom"
2
2
import { observeTextEditors } from "@atom-ide-community/nuclide-commons-atom/FileEventHandlers"
3
3
import CodeFormatManager , { SAVE_TIMEOUT } from "../src/CodeFormatManager"
4
4
import UniversalDisposable from "@atom-ide-community/nuclide-commons/UniversalDisposable"
@@ -8,17 +8,17 @@ import { waitFor, sleep } from "./utils"
8
8
9
9
jasmine . DEFAULT_TIMEOUT_INTERVAL = SAVE_TIMEOUT + 100
10
10
describe ( "CodeFormatManager" , ( ) => {
11
- let textEditor
12
- let manager
13
- let disposables
11
+ let textEditor : TextEditor
12
+ let manager : CodeFormatManager
13
+ let disposables : UniversalDisposable
14
14
beforeEach ( async ( ) => {
15
15
manager = new CodeFormatManager ( )
16
16
disposables = new UniversalDisposable ( observeTextEditors ( ) )
17
17
temp . track ( )
18
18
const file = temp . openSync ( )
19
19
textEditor = await atom . workspace . open ( file . path )
20
20
} )
21
- afterEach ( async ( ) => {
21
+ afterEach ( ( ) => {
22
22
manager . dispose ( )
23
23
disposables . dispose ( )
24
24
} )
@@ -36,7 +36,7 @@ describe("CodeFormatManager", () => {
36
36
] ) ,
37
37
} )
38
38
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" )
40
40
await waitFor ( ( ) => textEditor . getText ( ) === "def" )
41
41
} )
42
42
it ( "format an editor using formatEntireFile" , async ( ) => {
@@ -49,7 +49,7 @@ describe("CodeFormatManager", () => {
49
49
} ) ,
50
50
} )
51
51
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" )
53
53
await waitFor ( ( ) => textEditor . getText ( ) === "ghi" )
54
54
} )
55
55
it ( "formats an editor on type" , async ( ) => {
@@ -106,6 +106,7 @@ describe("CodeFormatManager", () => {
106
106
} ,
107
107
} )
108
108
const spy = spyOn ( textEditor . getBuffer ( ) , "save" )
109
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
109
110
textEditor . save ( )
110
111
// Wait until the buffer has been saved and verify it has been saved exactly
111
112
// once.
0 commit comments