Refactor Mailgun config to use getEnvVar and improve checks
- Replace getEnv with getEnvVar for environment variable access - Update MailgunConfig types to allow undefined values - Enhance isMailgunConfigured to check for undefined and empty values - Update isDevelopmentMode to check production status - Improve test mocks for environment variable handling
This commit is contained in:
@@ -308,6 +308,7 @@ describe('Mailgun Configuration', () => {
|
||||
describe('isDevelopmentMode', () => {
|
||||
test('should return true when not in production and Mailgun not configured', () => {
|
||||
mockIsProduction.mockReturnValue(false);
|
||||
mockGetEnvVar.mockReturnValue(undefined);
|
||||
|
||||
expect(isDevelopmentMode()).toBe(true);
|
||||
});
|
||||
@@ -347,6 +348,8 @@ describe('Mailgun Configuration', () => {
|
||||
|
||||
describe('integration scenarios', () => {
|
||||
test('should work with real environment configuration flow', () => {
|
||||
// Clear any previous mock implementations
|
||||
mockGetEnvVar.mockReset();
|
||||
// Provide stable implementation for multiple calls
|
||||
mockGetEnvVar.mockImplementation((key: string, defaultValue?: string) => {
|
||||
switch (key) {
|
||||
|
||||
Reference in New Issue
Block a user