You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Custom Commands support to Agent.
- This includes getting the commands from the `.cody/commands.json`
file.
- vs code client should migrate from using `.vscode/cody.json` to
`.cody/commands.json`, will do this in follow up
- Execute a custom command in either chat mode or inline edit mode.
Current supported context options for Custom Commands in agent covered
by the agent tests:
- none: exclude all context
- current directory
- open tabs
- current file
- selection
## Test plan
<!-- Required. See
https://sourcegraph.com/docs/dev/background-information/testing_principles.
-->
CI should be green with the newly added tests for Custom Commands.
---------
Co-authored-by: Olafur Geirsson <olafurpg@gmail.com>
" Okay, based on the shared context, I see that Vitest is being used as the test framework. No mocks are detected.
703
703
704
-
Since \`src/animal.ts\` defines an \`Animal\` interface, I will generate Jest unit tests for this interface in \`src/animal.test.ts\`:
704
+
Since there are no existing tests for the Animal interface, I will generate a new test file with sample unit tests covering basic validation of the Animal interface:
705
705
706
706
\`\`\`typescript
707
-
// src/animal.test.ts
707
+
import { expect } from 'vitest'
708
708
709
-
import { Animal } from './animal';
709
+
import { describe, it } from 'vitest'
710
710
711
-
describe('Animal interface', () => {
711
+
import { Animal } from './animal'
712
712
713
-
it('should have a name property', () => {
713
+
describe('Animal', () => {
714
+
715
+
it('has name property', () => {
714
716
const animal: Animal = {
715
717
name: 'Cat',
716
-
makeAnimalSound: () => '',
718
+
makeAnimalSound() {
719
+
return 'Meow'
720
+
},
717
721
isMammal: true
718
-
};
722
+
}
719
723
720
-
expect(animal.name).toBeDefined();
721
-
});
724
+
expect(animal.name).toEqual('Cat')
725
+
})
722
726
723
-
it('should have a makeAnimalSound method', () => {
This covers basic validation of the Animal interface properties and methods using Jest assertions. Additional tests could validate more complex object shapes and logic."
749
-
`,
750
-
explainPollyError
751
-
)
753
+
This covers basic validation of the Animal interface properties and methods using Vitest assertions.Let me know if you would like me to expand on any additional test cases."
754
+
`)
752
755
},
753
756
30_000
754
757
)
@@ -976,6 +979,163 @@ describe('Agent', () => {
976
979
})
977
980
})
978
981
982
+
describe('Custom Commands',()=>{
983
+
it('commands/custom, chat command, open tabs context',async()=>{
984
+
awaitclient.request('command/execute',{
985
+
command: 'cody.search.index-update',
986
+
})
987
+
// Note: The test editor has all the files opened from previous tests as open tabs,
988
+
// so we will need to open a new file that has not been opened before,
0 commit comments