MCPcopy
hub / github.com/coder/mux / validateApiKeys

Function validateApiKeys

tests/testUtils.js:72–81  ·  view source on GitHub ↗

* Validate required API keys are present * Throws if TEST_INTEGRATION is set but API keys are missing

(requiredKeys)

Source from the content-addressed store, hash-verified

70 * Throws if TEST_INTEGRATION is set but API keys are missing
71 */
72function validateApiKeys(requiredKeys) {
73 if (!shouldRunIntegrationTests()) {
74 return; // Skip validation if not running integration tests
75 }
76 const missing = requiredKeys.filter((key) => !process.env[key]);
77 if (missing.length > 0) {
78 throw new Error(`Integration tests require the following environment variables: ${missing.join(", ")}\n` +
79 `Please set them or unset TEST_INTEGRATION to skip these tests.`);
80 }
81}
82/**
83 * Get API key from environment or throw if missing (when TEST_INTEGRATION is set)
84 */

Calls 1

Tested by

no test coverage detected