-
Notifications
You must be signed in to change notification settings - Fork 59
feat: add SecretManager mocking #265
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
base: master
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
Adds a utility to mock Secret Manager values in tests by setting environment variables, and re-exports it for easier consumption.
- Introduce
mockSecretManager
to populateprocess.env
from a config object. - Re-export the helper in
src/main.ts
for public API access.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/secretManager.ts | Implements mockSecretManager to load mock secrets into process.env . |
src/main.ts | Adds export { mockSecretManager } for external use. |
Comments suppressed due to low confidence (1)
src/secretManager.ts:2
- There are currently no tests covering
mockSecretManager
. Add unit tests to verify it sets the expected environment variables and does not leak between test runs.
export function mockSecretManager(conf: { [key: string]: any }) {
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.
small change to improve types
Also maybe worth adding some simple tests on this, so behaviour is protected
@cabljac +1 on testing |
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.
Pull Request Overview
This PR adds a SecretManager mocking functionality to help with testing functions that rely on secret configuration values. Key changes include:
- New helper function (mockSecretManager) in src/secretManager.ts to set process.env variables.
- Export of the new function in src/main.ts.
- Comprehensive test cases in spec/secretmanager.spec.ts and corresponding import in spec/index.spec.ts.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/secretManager.ts | Introduces mockSecretManager to simulate secret configurations. |
src/main.ts | Exports mockSecretManager for external usage. |
spec/secretmanager.spec.ts | Provides tests validating the functionality of mockSecretManager. |
spec/index.spec.ts | Updates test index to include secretmanager.spec.ts. |
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.
lgtm
Resolves #255