Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

cody: refactor for unit testing #49369

Merged
merged 7 commits into from
Mar 15, 2023
Merged

Conversation

novoselrok
Copy link
Contributor

@novoselrok novoselrok commented Mar 15, 2023

This PR refactors parts of the extension to make it unit testable, specifically the Transcript class. This involved making the Transcript class and its dependencies independent of the VSCode API. I replaced specific implementations with interfaces where possible, allowing us to mock any dependencies we need. I added a single unit test as a proof of concept, and more will be coming in subsequent PRs.

I recommend that you review commit by commit, as I tried to group the relevant changes as much as possible.

Test plan

  • Run pnpm run build && pnpm run test:unit && pnpm run test:integration, tests should be green.

App preview:

Check out the client app preview documentation to learn more.

Copy link
Contributor

@dominiccooney dominiccooney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great.

Later we may want a "context" object, with each client taking one parameter which is the intersection of the parts of the context it needs, to cut down on stuttering in the parameter lists.

@novoselrok novoselrok merged commit 68ef7a9 into cody-main Mar 15, 2023
@novoselrok novoselrok deleted the rn/make-cody-unit-testable branch March 15, 2023 11:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants