1
1
/* eslint-env jest */
2
+ import assert from 'node:assert' ;
2
3
import * as testUtil from '../testUtil' ;
4
+ import type { Window } from './Window' ;
3
5
4
6
describe ( 'Window API' , ( ) => {
5
7
let nvim : ReturnType < typeof testUtil . startNvim > [ 1 ] ;
@@ -24,7 +26,7 @@ describe('Window API', () => {
24
26
} ) ;
25
27
26
28
describe ( 'Normal API calls' , ( ) => {
27
- let win ;
29
+ let win : Window ;
28
30
29
31
beforeEach ( async ( ) => {
30
32
win = await nvim . window ;
@@ -51,7 +53,7 @@ describe('Window API', () => {
51
53
} ) ;
52
54
53
55
it ( 'has same cursor position after appending a line to buffer' , async ( ) => {
54
- await win . buffer . append ( [ 'test' ] ) ;
56
+ await ( await win . buffer ) . append ( [ 'test' ] ) ;
55
57
expect ( await win . buffer . lines ) . toEqual ( [ '' , 'test' ] ) ;
56
58
expect ( await win . cursor ) . toEqual ( [ 1 , 0 ] ) ;
57
59
} ) ;
@@ -94,7 +96,7 @@ describe('Window API', () => {
94
96
} ) ;
95
97
96
98
it ( 'has the right window positions in display cells' , async ( ) => {
97
- let windows ;
99
+ let windows : Awaited < typeof nvim . windows > ;
98
100
nvim . command ( 'vsplit' ) ;
99
101
100
102
// XXX If we re-use `win` without a new call to `nvim.window`,
@@ -126,6 +128,7 @@ describe('Window API', () => {
126
128
expect ( await win . getOption ( 'list' ) ) . toBe ( true ) ;
127
129
win . setOption ( 'list' , false ) ;
128
130
expect ( await win . getOption ( 'list' ) ) . toBe ( false ) ;
131
+ assert ( list !== undefined ) ;
129
132
// Restore option
130
133
win . setOption ( 'list' , list ) ;
131
134
expect ( await win . getOption ( 'list' ) ) . toBe ( list ) ;
@@ -167,7 +170,7 @@ describe('Window API', () => {
167
170
} ) ;
168
171
169
172
it . skip ( 'gets current lines in buffer' , async ( ) => {
170
- expect ( await nvim . window . buffer . lines ) . toEqual ( [ 'test' ] ) ;
173
+ expect ( await ( await nvim . window . buffer ) . lines ) . toEqual ( [ 'test' ] ) ;
171
174
} ) ;
172
175
} ) ;
173
176
} ) ;
0 commit comments