-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add tests for terminal suggest widget, fix some bugs #234445
base: main
Are you sure you want to change the base?
Conversation
meganrogge
commented
Nov 22, 2024
•
edited
Loading
edited
Actually wip realized something |
}); | ||
}); | ||
|
||
function createTestCase(name: string, commandLineWithCursor: string, expectedSpecs: string[], resourcesRequested: 'files' | 'folders' | 'both' | 'neither', availableSpecs: Fig.Spec[], availableCommands: Set<string>): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you move this inside suite
you'll be able to access variables you declare in that block. This lets you do things like this:
let commands: string[]
setup(() => {
commands = ['default', 'set', ...];
});
function assertCompletions() {
// references commands
}
test(() => {
commands = ['custom test commands'];
});
}); | ||
|
||
suite('prefix: c', () => { | ||
createTestCase(`No available commands:`, 'c|', [], 'neither', availableSpecs, new Set()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd only generate tests inside a function like this if they originate from some array of specifications which is sometimes useful. Pulling the test
call out will make integration with IDEs better and make them easier to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there will be quite a bit of duplication if I do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also not sure what you mean about integration with other IDEs