Skip to content

Commit de8fa4d

Browse files
committed
Add comprehensive test coverage and Jest configuration for Secrets Store integration
- Add Jest configuration with proper module mapping and setup - Create Jest setup file and Cloudflare Workers mock - Add comprehensive Secrets Store binding tests covering: - Initialization from constructor options - Environment variable generation and sanitization - Merging environment variables during container start - Auto-detection of Secrets Store bindings - Validation success and failure cases - Summary and info retrieval methods - Install @types/jest dependency for proper test typing - Fix existing test expectations to match current defaults
1 parent 4858741 commit de8fa4d

File tree

5 files changed

+461
-11
lines changed

5 files changed

+461
-11
lines changed

jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ module.exports = {
66
transform: {
77
'^.+\\.ts$': ['ts-jest', { tsconfig: 'tsconfig.json' }]
88
},
9+
moduleNameMapper: {
10+
'^cloudflare:workers$': '<rootDir>/src/tests/__mocks__/cloudflare-workers.js'
11+
},
12+
setupFilesAfterEnv: ['<rootDir>/src/tests/setup.ts'],
913
collectCoverage: true,
1014
coverageDirectory: 'coverage',
1115
coverageReporters: ['text', 'lcov'],

package-lock.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Mock for cloudflare:workers module
2+
class DurableObject {
3+
constructor(ctx, env) {
4+
this.ctx = ctx;
5+
this.env = env;
6+
}
7+
8+
async fetch(request) {
9+
return new Response('Mock DurableObject response');
10+
}
11+
}
12+
13+
module.exports = { DurableObject };

0 commit comments

Comments
 (0)