TASK-CODE-20250419-234200.md•1.71 kB
# Task: Mock Config for Integration Test
**Status:** Pending
**Coordinator:** TASK-CMD-20250419-190107
**Assigned To:** code
**Acceptance Criteria:**
- The integration test `tests/integration.test.ts` is modified to mock the `src/config.ts` module.
- The mock should provide necessary dummy configuration values (like `appKey`, `secretKey`, `merchantNo`, etc.) required by `createPayment` and `queryPayment` for the test to run.
- The mock should prevent the actual file read attempt for `yop_platform_rsa_cert_rsa.cer`.
- The command `npx jest tests/integration.test.ts` runs without the "ENOENT: no such file or directory... yop_platform_rsa_cert_rsa.cer" error. (Other potential runtime errors related to API calls might still occur if those are not mocked).
**Context Files:**
- `tests/integration.test.ts`
- `src/config.ts`
- `src/tools/createPayment.ts`
- `src/tools/queryPayment.ts`
- `jest.config.js`
**Error to Bypass:**
```
Failed to read Yeepay platform public key at /Users/dreambt/sources/yop-mcp/yeepay-mcp/yop_platform_rsa_cert_rsa.cer: Error: ENOENT: no such file or directory...
```
**Checklist:**
- [⏳] Open `tests/integration.test.ts`.
- [⏳] Use `jest.mock('../src/config')` to mock the config module.
- [⏳] Provide a factory function to the mock that returns an object containing all necessary config properties with dummy/test values. Ensure `yopPublicKey` is included but doesn't rely on the file read.
- [⏳] Ensure the mock is defined *before* any imports that might trigger the original config load (like importing `createPayment` or `queryPayment`).
- [⏳] Run `npx jest tests/integration.test.ts` to verify the file read error is gone.
- [📣] Report completion or issues.