Skip to content

Commit 452b519

Browse files
committed
improve the tests
1 parent ca698f1 commit 452b519

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

packages/server/test/complete/complete_table.test.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,15 @@ describe('TableName completion', () => {
138138
schema
139139
)
140140

141-
// Should suggest table names, not columns
142-
expect(result.candidates).toEqual(
143-
expect.arrayContaining([expect.objectContaining({ label: 'notes' })])
144-
)
145-
// Should NOT include column suggestions
146-
expect(result.candidates).not.toEqual(
147-
expect.arrayContaining([expect.objectContaining({ label: 'id' })])
148-
)
149-
expect(result.candidates).not.toEqual(
150-
expect.arrayContaining([expect.objectContaining({ label: 'name' })])
151-
)
141+
// Should suggest table names
142+
const labels = result.candidates.map((c) => c.label)
143+
expect(labels).toContain('notes')
144+
145+
// Should NOT include any column suggestions (even if qualified)
146+
expect(labels).not.toEqual(expect.arrayContaining(['id', 'name']))
147+
148+
// All candidates should be tables (CompletionItemKind.Constant = 21)
149+
const TABLE_KIND = 21
150+
expect(result.candidates.every((c) => c.kind === TABLE_KIND)).toBe(true)
152151
})
153152
})

0 commit comments

Comments
 (0)