Skip to content

Commit 6a27072

Browse files
committed
Add assertions to restart test
1 parent 82c5dd7 commit 6a27072

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/tailwindcss-language-server/tests/env/restart.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,19 @@ defineTest({
140140
},
141141
})
142142

143+
expect(client.serverCapabilities).not.toEqual([])
144+
let ids1 = client.serverCapabilities.map((cap) => cap.id)
145+
143146
// Remove the CSS file
144147
let didRestart = new Promise((resolve) => {
145148
client.conn.onNotification('@/tailwindCSS/serverRestarted', resolve)
146149
})
147150
await fs.unlink(path.resolve(root, 'app.css'))
148151
await didRestart
149152

153+
expect(client.serverCapabilities).not.toEqual([])
154+
let ids2 = client.serverCapabilities.map((cap) => cap.id)
155+
150156
// <div class="text-primary">
151157
// ^
152158
let hover2 = await doc.hover({ line: 0, character: 13 })
@@ -164,11 +170,23 @@ defineTest({
164170
)
165171
await didRestartAgain
166172

173+
expect(client.serverCapabilities).not.toEqual([])
174+
let ids3 = client.serverCapabilities.map((cap) => cap.id)
175+
167176
await new Promise((resolve) => setTimeout(resolve, 500))
168177

169178
// <div class="text-primary">
170179
// ^
171180
let hover3 = await doc.hover({ line: 0, character: 13 })
172181
expect(hover3).toEqual(null)
182+
183+
expect(ids1).not.toContainEqual(expect.toBeOneOf(ids2))
184+
expect(ids1).not.toContainEqual(expect.toBeOneOf(ids3))
185+
186+
expect(ids2).not.toContainEqual(expect.toBeOneOf(ids1))
187+
expect(ids2).not.toContainEqual(expect.toBeOneOf(ids3))
188+
189+
expect(ids3).not.toContainEqual(expect.toBeOneOf(ids1))
190+
expect(ids3).not.toContainEqual(expect.toBeOneOf(ids2))
173191
},
174192
})

0 commit comments

Comments
 (0)