mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-15 04:26:48 -07:00
test(orchestrator): expand unit tests for enterprise services
Add comprehensive tests for CLI provider (cleanupWorkflow, garbageCollect, listWorkflow, watchWorkflow, stderr forwarding, timeout handling), local cache service (saveLfsCache full path and error handling), git hooks service (husky install, failure logging, edge cases), and LFS agent service (empty storagePaths, validate logging). 73 tests across 4 test files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -80,6 +80,23 @@ describe('LfsAgentService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('configure with empty storagePaths', () => {
|
||||
it('should not set LFS_STORAGE_PATHS when storagePaths is empty', async () => {
|
||||
(mockFs.existsSync as jest.Mock).mockReturnValue(true);
|
||||
|
||||
const originalValue = process.env.LFS_STORAGE_PATHS;
|
||||
delete process.env.LFS_STORAGE_PATHS;
|
||||
|
||||
await LfsAgentService.configure('/usr/local/bin/agent', '', [], '/repo');
|
||||
|
||||
expect(process.env.LFS_STORAGE_PATHS).toBeUndefined();
|
||||
|
||||
if (originalValue !== undefined) {
|
||||
process.env.LFS_STORAGE_PATHS = originalValue;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('validate', () => {
|
||||
it('should return true when agent executable exists', async () => {
|
||||
(mockFs.existsSync as jest.Mock).mockReturnValue(true);
|
||||
@@ -92,5 +109,16 @@ describe('LfsAgentService', () => {
|
||||
const result = await LfsAgentService.validate('/nonexistent/agent');
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
|
||||
it('should log warning when agent does not exist', async () => {
|
||||
(mockFs.existsSync as jest.Mock).mockReturnValue(false);
|
||||
const OrchestratorLogger = require('../core/orchestrator-logger').default;
|
||||
|
||||
await LfsAgentService.validate('/nonexistent/agent');
|
||||
|
||||
expect(OrchestratorLogger.logWarning).toHaveBeenCalledWith(
|
||||
expect.stringContaining('Agent executable not found'),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user