fix(automation): enable real OS automation for development mode
This commit is contained in:
@@ -6,8 +6,8 @@
|
|||||||
*
|
*
|
||||||
* Mapping:
|
* Mapping:
|
||||||
* - NODE_ENV=production → NutJsAutomationAdapter → iRacing Window → Image Templates
|
* - NODE_ENV=production → NutJsAutomationAdapter → iRacing Window → Image Templates
|
||||||
|
* - NODE_ENV=development → NutJsAutomationAdapter → iRacing Window → Image Templates
|
||||||
* - NODE_ENV=test → MockBrowserAutomation → N/A → N/A
|
* - NODE_ENV=test → MockBrowserAutomation → N/A → N/A
|
||||||
* - NODE_ENV=development → MockBrowserAutomation → N/A → N/A
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type AutomationMode = 'production' | 'test';
|
export type AutomationMode = 'production' | 'test';
|
||||||
@@ -60,7 +60,8 @@ export function getAutomationMode(): AutomationMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const nodeEnv = process.env.NODE_ENV;
|
const nodeEnv = process.env.NODE_ENV;
|
||||||
if (nodeEnv === 'production') return 'production';
|
// Both production and development use real OS automation
|
||||||
|
if (nodeEnv === 'production' || nodeEnv === 'development') return 'production';
|
||||||
return 'test';
|
return 'test';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,13 +52,13 @@ describe('AutomationConfig', () => {
|
|||||||
expect(mode).toBe('test');
|
expect(mode).toBe('test');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return test mode when NODE_ENV=development', () => {
|
it('should return production mode when NODE_ENV=development', () => {
|
||||||
process.env.NODE_ENV = 'development';
|
process.env.NODE_ENV = 'development';
|
||||||
delete process.env.AUTOMATION_MODE;
|
delete process.env.AUTOMATION_MODE;
|
||||||
|
|
||||||
const mode = getAutomationMode();
|
const mode = getAutomationMode();
|
||||||
|
|
||||||
expect(mode).toBe('test');
|
expect(mode).toBe('production');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user