-
Notifications
You must be signed in to change notification settings - Fork 3k
Expand file tree
/
Copy pathcontext-mentions.spec.ts
More file actions
629 lines (534 loc) · 23.4 KB
/
context-mentions.spec.ts
File metadata and controls
629 lines (534 loc) · 23.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
import {
insertMention,
removeMention,
getContextMenuOptions,
shouldShowContextMenu,
ContextMenuOptionType,
ContextMenuQueryItem,
SearchResult,
} from "@src/utils/context-mentions"
describe("insertMention", () => {
it("should insert mention at cursor position when no @ symbol exists", () => {
const result = insertMention("Hello world", 5, "test")
expect(result.newValue).toBe("Hello@test world")
expect(result.mentionIndex).toBe(5)
})
it("should replace text after last @ symbol", () => {
const result = insertMention("Hello @wor world", 8, "test")
expect(result.newValue).toBe("Hello @test world")
expect(result.mentionIndex).toBe(6)
})
it("should handle empty text", () => {
const result = insertMention("", 0, "test")
expect(result.newValue).toBe("@test ")
expect(result.mentionIndex).toBe(0)
})
it("should replace partial mention after @", () => {
const result = insertMention("Mention @fi", 11, "/path/to/file.txt") // Cursor after 'i'
expect(result.newValue).toBe("Mention @/path/to/file.txt ") // Space added after mention
expect(result.mentionIndex).toBe(8)
})
it("should add a space after the inserted mention", () => {
const result = insertMention("Hello ", 6, "terminal") // Cursor at the end
expect(result.newValue).toBe("Hello @terminal ")
expect(result.mentionIndex).toBe(6)
})
it("should handle insertion at the beginning", () => {
const result = insertMention("world", 0, "problems")
expect(result.newValue).toBe("@problems world")
expect(result.mentionIndex).toBe(0)
})
it("should handle insertion at the end", () => {
const result = insertMention("Hello", 5, "problems")
expect(result.newValue).toBe("Hello@problems ")
expect(result.mentionIndex).toBe(5)
})
it("should handle slash command replacement", () => {
const result = insertMention("/mode some", 5, "code", true) // Simulating mode selection
expect(result.newValue).toBe("code some") // Should replace slash token on current line, preserve rest
expect(result.mentionIndex).toBe(0)
})
// --- Tests for Escaped Spaces ---
it("should NOT escape spaces for non-path mentions", () => {
const result = insertMention("Hello @abc ", 10, "git commit with spaces") // Not a path
expect(result.newValue).toBe("Hello @git commit with spaces ")
})
it("should escape spaces when inserting a file path mention with spaces", () => {
const filePath = "/path/to/file with spaces.txt"
const expectedEscapedPath = "/path/to/file\\ with\\ spaces.txt"
const result = insertMention("Mention @old", 11, filePath)
expect(result.newValue).toBe(`Mention @${expectedEscapedPath} `)
expect(result.mentionIndex).toBe(8)
// Verify escapeSpaces was effectively used (implicitly by checking output)
expect(result.newValue).toContain("\\ ")
})
it("should escape spaces when inserting a folder path mention with spaces", () => {
const folderPath = "/my documents/folder name/"
const expectedEscapedPath = "/my\\ documents/folder\\ name/"
const result = insertMention("Check @dir", 9, folderPath)
expect(result.newValue).toBe(`Check @${expectedEscapedPath} `)
expect(result.mentionIndex).toBe(6)
expect(result.newValue).toContain("\\ ")
})
it("should NOT escape spaces if the path value already contains escaped spaces", () => {
const alreadyEscapedPath = "/path/already\\ escaped.txt"
const result = insertMention("Insert @path", 11, alreadyEscapedPath)
// It should insert the already escaped path without double-escaping
expect(result.newValue).toBe(`Insert @${alreadyEscapedPath} `)
expect(result.mentionIndex).toBe(7)
// Check that it wasn't passed through escapeSpaces again (mock check)
// This relies on the mock implementation detail or careful checking
// A better check might be ensuring no double backslashes appear unexpectedly.
expect(result.newValue.includes("\\\\ ")).toBe(false)
})
it("should NOT escape spaces for paths without spaces", () => {
const simplePath = "/path/to/file.txt"
const result = insertMention("Simple @p", 9, simplePath)
expect(result.newValue).toBe(`Simple @${simplePath} `)
expect(result.mentionIndex).toBe(7)
expect(result.newValue.includes("\\ ")).toBe(false)
})
// --- Tests for isSlashCommand parameter ---
describe("isSlashCommand parameter", () => {
it("should replace slash token on current line when isSlashCommand is true", () => {
const result = insertMention("/cod", 4, "code", true)
expect(result.newValue).toBe("code")
expect(result.mentionIndex).toBe(0)
})
it("should replace slash token but preserve text after cursor when isSlashCommand is true", () => {
const result = insertMention("/code @some/file.ts", 5, "debug", true)
expect(result.newValue).toBe("debug @some/file.ts")
expect(result.mentionIndex).toBe(0)
})
it("should replace only current line slash token in multiline text", () => {
const text = "/code\n/deb"
const position = 10 // cursor at end of "/deb"
const result = insertMention(text, position, "debug", true)
expect(result.newValue).toBe("/code\ndebug")
expect(result.mentionIndex).toBe(6) // start of second line
})
it("should preserve other lines when inserting slash command on second line", () => {
const text = "/code\nsome text here\n/arc"
const position = 25 // cursor at end of "/arc"
const result = insertMention(text, position, "architect", true)
expect(result.newValue).toBe("/code\nsome text here\narchitect")
expect(result.mentionIndex).toBe(21) // start of third line
})
it("should insert @ mention correctly after slash command when isSlashCommand is false", () => {
const text = "/code @"
const position = 8 // cursor after @
const result = insertMention(text, position, "src/file.ts", false)
expect(result.newValue).toBe("/code @src/file.ts ")
expect(result.mentionIndex).toBe(6) // position of @
})
it("should not treat text starting with / as slash command when isSlashCommand is false", () => {
const text = "/some/path/file.ts @"
const position = 20
const result = insertMention(text, position, "another.ts", false)
expect(result.newValue).toBe("/some/path/file.ts @another.ts ")
expect(result.mentionIndex).toBe(19) // position of @
})
it("should work with default parameter (isSlashCommand = false)", () => {
const text = "/code @"
const position = 8
const result = insertMention(text, position, "src/file.ts") // No isSlashCommand parameter
expect(result.newValue).toBe("/code @src/file.ts ")
expect(result.mentionIndex).toBe(6)
})
})
})
describe("removeMention", () => {
it("should remove mention when cursor is at end of mention", () => {
// Test with the problems keyword that matches the regex
const result = removeMention("Hello @problems ", 15)
expect(result.newText).toBe("Hello ")
expect(result.newPosition).toBe(6)
})
it("should not remove text when not at end of mention", () => {
const result = removeMention("Hello @test world", 8)
expect(result.newText).toBe("Hello @test world")
expect(result.newPosition).toBe(8)
})
it("should handle text without mentions", () => {
const result = removeMention("Hello world", 5)
expect(result.newText).toBe("Hello world")
expect(result.newPosition).toBe(5)
})
// --- Tests for Escaped Spaces ---
it("should not remove mention with escaped spaces if cursor is at the end - KNOWN LIMITATION", () => {
// NOTE: This is a known limitation - the current regex in removeMention
// doesn't handle escaped spaces well because the regex engine needs
// special lookbehind assertions for that.
// For now, we're documenting this as a known limitation.
const text = "File @/path/to/file\\ with\\ spaces.txt "
const position = text.length // Cursor at the very end
const { newText, newPosition } = removeMention(text, position)
// The mention with escaped spaces won't be matched by the regex
expect(newText).toBe(text)
expect(newPosition).toBe(position)
})
it("should remove mention with escaped spaces and the following space", () => {
const text = "File @/path/to/file\\ with\\ spaces.txt next word"
const position = text.indexOf(" next") // Cursor right after the mention + space
const { newText, newPosition } = removeMention(text, position)
expect(newText).toBe("File next word")
expect(newPosition).toBe(5)
})
})
describe("getContextMenuOptions", () => {
const mockQueryItems: ContextMenuQueryItem[] = [
{
type: ContextMenuOptionType.File,
value: "src/test.ts",
label: "test.ts",
description: "Source file",
},
{
type: ContextMenuOptionType.OpenedFile,
value: "src/open file.ts",
label: "open file.ts",
description: "Currently opened file",
},
{
type: ContextMenuOptionType.Git,
value: "abc1234",
label: "Initial commit",
description: "First commit",
icon: "$(git-commit)",
},
{
type: ContextMenuOptionType.Folder,
value: "src",
label: "src",
description: "Source folder",
},
]
const mockDynamicSearchResults = [
{
path: "search/result1.ts",
type: "file" as const,
label: "result1.ts",
},
{
path: "search/folder",
type: "folder" as const,
},
]
const mockSearchResults: SearchResult[] = [
{ path: "/Users/test/project/src/search result spaces.ts", type: "file", label: "search result spaces.ts" },
{ path: "/Users/test/project/assets/", type: "folder", label: "assets/" },
]
it("should return all option types for empty query", () => {
const result = getContextMenuOptions("", null, [])
expect(result).toHaveLength(6)
expect(result.map((item) => item.type)).toEqual([
ContextMenuOptionType.Problems,
ContextMenuOptionType.Terminal,
ContextMenuOptionType.URL,
ContextMenuOptionType.Folder,
ContextMenuOptionType.File,
ContextMenuOptionType.Git,
])
})
it("should filter by selected type when query is empty", () => {
const result = getContextMenuOptions("", ContextMenuOptionType.File, mockQueryItems)
expect(result).toHaveLength(2)
expect(result.map((item) => item.type)).toContain(ContextMenuOptionType.File)
expect(result.map((item) => item.type)).toContain(ContextMenuOptionType.OpenedFile)
expect(result.map((item) => item.value)).toContain("src/test.ts")
expect(result.map((item) => item.value)).toContain("src/open file.ts")
})
it("should match git commands", () => {
const result = getContextMenuOptions("git", null, mockQueryItems)
expect(result[0].type).toBe(ContextMenuOptionType.Git)
expect(result[0].label).toBe("Git Commits")
})
it("should match git commit hashes", () => {
const result = getContextMenuOptions("abc1234", null, mockQueryItems)
expect(result[0].type).toBe(ContextMenuOptionType.Git)
expect(result[0].value).toBe("abc1234")
})
it("should return NoResults when no matches found", () => {
const result = getContextMenuOptions("nonexistent", null, mockQueryItems)
expect(result).toHaveLength(1)
expect(result[0].type).toBe(ContextMenuOptionType.NoResults)
})
/**
* Tests for the combined handling of open files, git results, and search results
* Added for commit 3cd7dec78faf786e468ae4f66cef0b81a76d9075
*/
it("should include dynamic search results along with other matches", () => {
// Add an opened file that will match the query
const testItems = [
...mockQueryItems,
{
type: ContextMenuOptionType.OpenedFile,
value: "src/test-opened.ts",
label: "test-opened.ts",
description: "Opened test file for search test",
},
]
const result = getContextMenuOptions("test", null, testItems, mockDynamicSearchResults)
// Check if opened files and dynamic search results are included
expect(result.some((item) => item.type === ContextMenuOptionType.OpenedFile)).toBe(true)
expect(result.some((item) => item.value === "/search/result1.ts")).toBe(true)
})
it("should maintain correct result ordering according to implementation", () => {
// Add multiple item types to test ordering
const result = getContextMenuOptions("t", null, mockQueryItems, mockDynamicSearchResults)
// Find the different result types
const fileResults = result.filter(
(item) =>
item.type === ContextMenuOptionType.File ||
item.type === ContextMenuOptionType.OpenedFile ||
item.type === ContextMenuOptionType.Folder,
)
const searchResults = result.filter(
(item) => item.type === ContextMenuOptionType.File && item.value?.includes("/search/"),
)
const gitResults = result.filter((item) => item.type === ContextMenuOptionType.Git)
// Find the indexes of the first item of each type in the results array
const firstFileIndex = result.findIndex((item) => fileResults.some((f) => f === item))
const firstSearchResultIndex = result.findIndex((item) => searchResults.some((s) => s === item))
const firstGitResultIndex = result.findIndex((item) => gitResults.some((g) => g === item))
// Verify file results come before search results
expect(firstFileIndex).toBeLessThan(firstSearchResultIndex)
// Verify search results appear before git results
expect(firstSearchResultIndex).toBeLessThan(firstGitResultIndex)
})
it("should include opened files when dynamic search results exist", () => {
const result = getContextMenuOptions("open", null, mockQueryItems, mockDynamicSearchResults)
// Verify opened files are included
expect(result.some((item) => item.type === ContextMenuOptionType.OpenedFile)).toBe(true)
// Verify dynamic search results are also present
expect(result.some((item) => item.value === "/search/result1.ts")).toBe(true)
})
it("should include git results when dynamic search results exist", () => {
const result = getContextMenuOptions("commit", null, mockQueryItems, mockDynamicSearchResults)
// Verify git results are included
expect(result.some((item) => item.type === ContextMenuOptionType.Git)).toBe(true)
// Verify dynamic search results are also present
expect(result.some((item) => item.value === "/search/result1.ts")).toBe(true)
})
it("should deduplicate items correctly when combining different result types", () => {
// Create duplicate search result with same path as an existing file
const duplicateSearchResults = [
{
path: "src/test.ts", // Duplicate of existing file in mockQueryItems
type: "file" as const,
},
{
path: "unique/path.ts",
type: "file" as const,
},
]
const result = getContextMenuOptions("test", null, mockQueryItems, duplicateSearchResults)
// Count occurrences of src/test.ts in results
const duplicateCount = result.filter(
(item) =>
(item.value === "src/test.ts" || item.value === "/src/test.ts") &&
item.type === ContextMenuOptionType.File,
).length
// With path normalization, these should be treated as duplicates
expect(duplicateCount).toBe(1)
// Verify the unique item was included (check both path formats)
expect(result.some((item) => item.value === "/unique/path.ts" || item.value === "unique/path.ts")).toBe(true)
})
it("should return NoResults when all combined results are empty with dynamic search", () => {
// Use a query that won't match anything
const result = getContextMenuOptions(
"nonexistentquery123456",
null,
mockQueryItems,
[], // Empty dynamic search results
)
expect(result).toHaveLength(1)
expect(result[0].type).toBe(ContextMenuOptionType.NoResults)
})
/**
* Tests that opened files appear first in the results, according to the updated implementation
* This test validates the updated ordering where opened files have the highest priority
*/
it("should place opened files first in result order", () => {
// Create test data with multiple types that should match the query
const testQuery = "test" // Using "test" as the query to match all items
const testItems: ContextMenuQueryItem[] = [
{
type: ContextMenuOptionType.File,
value: "src/test-file.ts",
label: "test-file.ts",
description: "Regular test file",
},
{
type: ContextMenuOptionType.OpenedFile,
value: "src/test-opened.ts",
label: "test-opened.ts",
description: "Opened test file",
},
{
type: ContextMenuOptionType.Git,
value: "abctest",
label: "Test commit",
description: "Git test commit",
},
]
const testSearchResults = [
{
path: "search/test-result.ts",
type: "file" as const,
label: "test-result.ts",
},
]
// Get results for "test" query
const result = getContextMenuOptions(testQuery, null, testItems, testSearchResults)
// Verify we have results
expect(result.length).toBeGreaterThan(0)
// Verify the first item is an opened file type
expect(result[0].type).toBe(ContextMenuOptionType.OpenedFile)
// Verify the remaining items are in the correct order:
// suggestions -> openedFiles -> searchResults -> gitResults
// Get index of first item of each type
const firstOpenedFileIndex = result.findIndex((item) => item.type === ContextMenuOptionType.OpenedFile)
const firstSearchResultIndex = result.findIndex(
(item) => item.type === ContextMenuOptionType.File && item.value?.includes("/search/"),
)
const firstGitResultIndex = result.findIndex((item) => item.type === ContextMenuOptionType.Git)
// Verify opened files come first
expect(firstOpenedFileIndex).toBe(0)
// Verify search results come after opened files but before git results
expect(firstSearchResultIndex).toBeGreaterThan(firstOpenedFileIndex)
// Verify git results come after search results
if (firstGitResultIndex !== -1 && firstSearchResultIndex !== -1) {
expect(firstGitResultIndex).toBeGreaterThan(firstSearchResultIndex)
}
})
it("should process slash commands when both query and inputValue start with slash", () => {
const mockModes = [
{
slug: "code",
name: "Code",
roleDefinition: "You are a coding assistant",
groups: ["read" as const, "edit" as const],
},
{
slug: "architect",
name: "Architect",
roleDefinition: "You are an architecture assistant",
groups: ["read" as const],
},
]
const result = getContextMenuOptions("/co", null, [], [], mockModes)
// Should have section header first, then mode results
expect(result[0].type).toBe(ContextMenuOptionType.SectionHeader)
expect(result[1].type).toBe(ContextMenuOptionType.Mode)
expect(result[1].value).toBe("code")
})
it("should not process slash commands when query starts with slash but inputValue doesn't", () => {
// Use a completely non-matching query to ensure we get NoResults
// and provide empty query items to avoid any matches
const result = getContextMenuOptions("/nonexistentquery", null, [], [])
// Should not process as a mode command
expect(result[0].type).not.toBe(ContextMenuOptionType.Mode)
// Should return NoResults since it won't match anything
expect(result[0].type).toBe(ContextMenuOptionType.NoResults)
})
// --- Tests for Escaped Spaces (Focus on how paths are presented) ---
it("should return search results with correct labels/descriptions (no escaping needed here)", () => {
const options = getContextMenuOptions("@search", null, mockQueryItems, mockSearchResults)
const fileResult = options.find((o) => o.label === "search result spaces.ts")
expect(fileResult).toBeDefined()
// Value should be the normalized path, description might be the same or label
expect(fileResult?.value).toBe("/Users/test/project/src/search result spaces.ts")
expect(fileResult?.description).toBe("/Users/test/project/src/search result spaces.ts") // Check current implementation
expect(fileResult?.label).toBe("search result spaces.ts")
// Crucially, no backslashes should be in label/description here
expect(fileResult?.label).not.toContain("\\")
expect(fileResult?.description).not.toContain("\\")
})
it("should return query items (like opened files) with correct labels/descriptions", () => {
const options = getContextMenuOptions("open", null, mockQueryItems, [])
const openedFile = options.find((o) => o.label === "open file.ts")
expect(openedFile).toBeDefined()
expect(openedFile?.value).toBe("src/open file.ts")
// Check label/description based on current implementation
expect(openedFile?.label).toBe("open file.ts")
// No backslashes expected in display values
expect(openedFile?.label).not.toContain("\\")
})
it("should handle formatting of search results without escaping spaces in display", () => {
// Create a search result with spaces in the path
const searchResults: SearchResult[] = [
{ path: "/path/with spaces/file.txt", type: "file", label: "file with spaces.txt" },
]
// The formatting happens in getContextMenuOptions when converting search results to menu items
const formattedItems = getContextMenuOptions("spaces", null, [], searchResults)
// Verify we get some results back that aren't "No Results"
expect(formattedItems.length).toBeGreaterThan(0)
expect(formattedItems[0].type !== ContextMenuOptionType.NoResults).toBeTruthy()
// The main thing we want to verify is that no backslashes show up in any display fields
// This is the core UI behavior we want to test - spaces should not be escaped in display text
formattedItems.forEach((item) => {
// Some items might not have labels or descriptions, so check conditionally
if (item.label) {
// Verify the label doesn't contain any escaped spaces
expect(item.label.indexOf("\\")).toBe(-1)
}
if (item.description) {
// Verify the description doesn't contain any escaped spaces
expect(item.description.indexOf("\\")).toBe(-1)
}
})
})
// Add more tests for filtering, fuzzy search interaction if needed
})
describe("shouldShowContextMenu", () => {
it("should return true for @ symbol", () => {
expect(shouldShowContextMenu("@", 1)).toBe(true)
})
it("should return true for @ followed by text", () => {
expect(shouldShowContextMenu("Hello @test", 10)).toBe(true)
})
it("should return false when no @ symbol exists", () => {
expect(shouldShowContextMenu("Hello world", 5)).toBe(false)
})
it("should return false for @ followed by whitespace", () => {
expect(shouldShowContextMenu("Hello @ world", 6)).toBe(false)
})
it("should return false for @ in URL", () => {
expect(shouldShowContextMenu("Hello @http://test.com", 17)).toBe(false)
})
it("should return true for @problems", () => {
// Position cursor at the end to test the full word
expect(shouldShowContextMenu("@problems", 9)).toBe(true)
})
// --- Tests for Escaped Spaces ---
it("should return true when typing path with escaped spaces", () => {
expect(shouldShowContextMenu("@/path/to/file\\ ", 17)).toBe(true) // Cursor after escaped space
expect(shouldShowContextMenu("@/path/to/file\\ with\\ spaces", 28)).toBe(true) // Cursor within path after escaped spaces
})
it("should return false if an unescaped space exists after @", () => {
// This case means the regex wouldn't match anyway, but confirms context menu logic
expect(shouldShowContextMenu("@/path/with space", 13)).toBe(false) // Cursor after unescaped space
})
// --- Multiline slash command tests ---
it("should return true for slash command on second line", () => {
const text = "/code\n/deb"
const position = 10 // cursor at end of "/deb"
expect(shouldShowContextMenu(text, position)).toBe(true)
})
it("should return true for slash command on third line", () => {
const text = "/code\nsome text\n/arc"
const position = 19 // cursor at end of "/arc"
expect(shouldShowContextMenu(text, position)).toBe(true)
})
it("should return false for non-slash text on second line without @", () => {
const text = "/code\nhello"
const position = 11 // cursor at end of "hello"
expect(shouldShowContextMenu(text, position)).toBe(false)
})
it("should return false for slash command with space on second line", () => {
const text = "/code\n/debug something"
const position = 13 // cursor after space in "/debug "
expect(shouldShowContextMenu(text, position)).toBe(false)
})
})