Skip to content

Commit 3976b7c

Browse files
frostebiteclaude
andcommitted
style: fix prettier formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f06f99b commit 3976b7c

File tree

6 files changed

+56
-150
lines changed

6 files changed

+56
-150
lines changed

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/model/orchestrator/services/cache/local-cache-service.test.ts

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ describe('LocalCacheService', () => {
107107
const result = await LocalCacheService.restoreLibraryCache('/project', '/cache', 'key1');
108108

109109
expect(result).toBe(true);
110-
expect(OrchestratorSystem.Run).toHaveBeenCalledWith(
111-
expect.stringContaining('lib-2000.tar'),
112-
true,
113-
);
110+
expect(OrchestratorSystem.Run).toHaveBeenCalledWith(expect.stringContaining('lib-2000.tar'), true);
114111
});
115112

116113
it('should return false and log warning on error', async () => {
@@ -154,10 +151,7 @@ describe('LocalCacheService', () => {
154151

155152
await LocalCacheService.saveLibraryCache('/project', '/cache', 'key1');
156153
expect(mockFs.mkdirSync).toHaveBeenCalledWith(path.join('/cache', 'key1', 'Library'), { recursive: true });
157-
expect(OrchestratorSystem.Run).toHaveBeenCalledWith(
158-
expect.stringContaining('tar -cf'),
159-
true,
160-
);
154+
expect(OrchestratorSystem.Run).toHaveBeenCalledWith(expect.stringContaining('tar -cf'), true);
161155
});
162156
});
163157

@@ -187,10 +181,7 @@ describe('LocalCacheService', () => {
187181
const result = await LocalCacheService.restoreLfsCache('/repo', '/cache', 'key1');
188182

189183
expect(result).toBe(true);
190-
expect(OrchestratorSystem.Run).toHaveBeenCalledWith(
191-
expect.stringContaining('lfs-200.tar'),
192-
true,
193-
);
184+
expect(OrchestratorSystem.Run).toHaveBeenCalledWith(expect.stringContaining('lfs-200.tar'), true);
194185
});
195186
});
196187

@@ -224,10 +215,7 @@ describe('LocalCacheService', () => {
224215

225216
await LocalCacheService.saveLfsCache('/repo', '/cache', 'key1');
226217
expect(mockFs.mkdirSync).toHaveBeenCalledWith(path.join('/cache', 'key1', 'lfs'), { recursive: true });
227-
expect(OrchestratorSystem.Run).toHaveBeenCalledWith(
228-
expect.stringContaining('tar -cf'),
229-
true,
230-
);
218+
expect(OrchestratorSystem.Run).toHaveBeenCalledWith(expect.stringContaining('tar -cf'), true);
231219
});
232220

233221
it('should handle save errors gracefully', async () => {
@@ -263,10 +251,7 @@ describe('LocalCacheService', () => {
263251
await LocalCacheService.garbageCollect('/cache', 7);
264252

265253
expect(mockFs.rmSync).toHaveBeenCalledTimes(1);
266-
expect(mockFs.rmSync).toHaveBeenCalledWith(
267-
path.join('/cache', 'old-cache'),
268-
{ recursive: true, force: true },
269-
);
254+
expect(mockFs.rmSync).toHaveBeenCalledWith(path.join('/cache', 'old-cache'), { recursive: true, force: true });
270255
});
271256

272257
it('should not remove directories newer than maxAgeDays', async () => {

src/model/orchestrator/services/hooks/git-hooks-service.test.ts

Lines changed: 34 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,26 @@ describe('GitHooksService', () => {
6464
describe('detectUnityGitHooks', () => {
6565
it('should return true when package is in manifest.json', () => {
6666
(mockFs.existsSync as jest.Mock).mockReturnValue(true);
67-
(mockFs.readFileSync as jest.Mock).mockReturnValue(JSON.stringify({
68-
dependencies: {
69-
'com.frostebite.unitygithooks': 'https://github.com/frostebite/UnityGitHooks.git#1.0.5',
70-
},
71-
}));
67+
(mockFs.readFileSync as jest.Mock).mockReturnValue(
68+
JSON.stringify({
69+
dependencies: {
70+
'com.frostebite.unitygithooks': 'https://github.com/frostebite/UnityGitHooks.git#1.0.5',
71+
},
72+
}),
73+
);
7274

7375
expect(GitHooksService.detectUnityGitHooks('/repo')).toBe(true);
7476
});
7577

7678
it('should return false when package is not in manifest.json', () => {
7779
(mockFs.existsSync as jest.Mock).mockReturnValue(true);
78-
(mockFs.readFileSync as jest.Mock).mockReturnValue(JSON.stringify({
79-
dependencies: {
80-
'com.unity.textmeshpro': '3.0.6',
81-
},
82-
}));
80+
(mockFs.readFileSync as jest.Mock).mockReturnValue(
81+
JSON.stringify({
82+
dependencies: {
83+
'com.unity.textmeshpro': '3.0.6',
84+
},
85+
}),
86+
);
8387

8488
expect(GitHooksService.detectUnityGitHooks('/repo')).toBe(false);
8589
});
@@ -115,9 +119,7 @@ describe('GitHooksService', () => {
115119

116120
it('should return empty string when package not in cache', () => {
117121
(mockFs.existsSync as jest.Mock).mockReturnValue(true);
118-
(mockFs.readdirSync as jest.Mock).mockReturnValue([
119-
'com.unity.textmeshpro@3.0.6',
120-
]);
122+
(mockFs.readdirSync as jest.Mock).mockReturnValue(['com.unity.textmeshpro@3.0.6']);
121123

122124
const result = GitHooksService.findUnityGitHooksPackagePath('/repo');
123125
expect(result).toBe('');
@@ -136,16 +138,11 @@ describe('GitHooksService', () => {
136138
const { OrchestratorSystem } = require('../core/orchestrator-system');
137139

138140
(mockFs.existsSync as jest.Mock).mockReturnValue(true);
139-
(mockFs.readdirSync as jest.Mock).mockReturnValue([
140-
'com.frostebite.unitygithooks@1.0.5',
141-
]);
141+
(mockFs.readdirSync as jest.Mock).mockReturnValue(['com.frostebite.unitygithooks@1.0.5']);
142142

143143
await GitHooksService.initUnityGitHooks('/repo');
144144

145-
expect(OrchestratorSystem.Run).toHaveBeenCalledWith(
146-
expect.stringContaining('init-unity-lefthook.js'),
147-
true,
148-
);
145+
expect(OrchestratorSystem.Run).toHaveBeenCalledWith(expect.stringContaining('init-unity-lefthook.js'), true);
149146
});
150147

151148
it('should skip when package not found in cache', async () => {
@@ -165,32 +162,24 @@ describe('GitHooksService', () => {
165162
// PackageCache dir exists, but init script doesn't
166163
return !String(p).includes('init-unity-lefthook');
167164
});
168-
(mockFs.readdirSync as jest.Mock).mockReturnValue([
169-
'com.frostebite.unitygithooks@1.0.5',
170-
]);
165+
(mockFs.readdirSync as jest.Mock).mockReturnValue(['com.frostebite.unitygithooks@1.0.5']);
171166

172167
await GitHooksService.initUnityGitHooks('/repo');
173168

174-
expect(OrchestratorLogger.logWarning).toHaveBeenCalledWith(
175-
expect.stringContaining('init script not found'),
176-
);
169+
expect(OrchestratorLogger.logWarning).toHaveBeenCalledWith(expect.stringContaining('init script not found'));
177170
});
178171

179172
it('should log warning on init failure', async () => {
180173
const { OrchestratorSystem } = require('../core/orchestrator-system');
181174
const OrchestratorLogger = require('../core/orchestrator-logger').default;
182175

183176
(mockFs.existsSync as jest.Mock).mockReturnValue(true);
184-
(mockFs.readdirSync as jest.Mock).mockReturnValue([
185-
'com.frostebite.unitygithooks@1.0.5',
186-
]);
177+
(mockFs.readdirSync as jest.Mock).mockReturnValue(['com.frostebite.unitygithooks@1.0.5']);
187178
OrchestratorSystem.Run.mockRejectedValue(new Error('node not found'));
188179

189180
await GitHooksService.initUnityGitHooks('/repo');
190181

191-
expect(OrchestratorLogger.logWarning).toHaveBeenCalledWith(
192-
expect.stringContaining('init failed'),
193-
);
182+
expect(OrchestratorLogger.logWarning).toHaveBeenCalledWith(expect.stringContaining('init failed'));
194183
});
195184
});
196185

@@ -228,9 +217,7 @@ describe('GitHooksService', () => {
228217
(mockFs.readFileSync as jest.Mock).mockReturnValue(
229218
`{"dependencies":{"com.frostebite.unitygithooks":"https://github.com/frostebite/UnityGitHooks.git"}}`,
230219
);
231-
(mockFs.readdirSync as jest.Mock).mockReturnValue([
232-
'com.frostebite.unitygithooks@1.0.5',
233-
]);
220+
(mockFs.readdirSync as jest.Mock).mockReturnValue(['com.frostebite.unitygithooks@1.0.5']);
234221

235222
OrchestratorSystem.Run.mockImplementation((cmd: string) => {
236223
if (cmd.includes('init-unity-lefthook')) {
@@ -246,19 +233,13 @@ describe('GitHooksService', () => {
246233

247234
// Init should happen before install
248235
expect(callOrder).toEqual(['init', 'install']);
249-
expect(OrchestratorLogger.log).toHaveBeenCalledWith(
250-
expect.stringContaining('Unity Git Hooks (UPM) detected'),
251-
);
236+
expect(OrchestratorLogger.log).toHaveBeenCalledWith(expect.stringContaining('Unity Git Hooks (UPM) detected'));
252237
});
253238

254239
it('should set CI env vars when Unity Git Hooks detected', async () => {
255240
(mockFs.existsSync as jest.Mock).mockReturnValue(true);
256-
(mockFs.readFileSync as jest.Mock).mockReturnValue(
257-
`{"dependencies":{"com.frostebite.unitygithooks":"1.0.5"}}`,
258-
);
259-
(mockFs.readdirSync as jest.Mock).mockReturnValue([
260-
'com.frostebite.unitygithooks@1.0.5',
261-
]);
241+
(mockFs.readFileSync as jest.Mock).mockReturnValue(`{"dependencies":{"com.frostebite.unitygithooks":"1.0.5"}}`);
242+
(mockFs.readdirSync as jest.Mock).mockReturnValue(['com.frostebite.unitygithooks@1.0.5']);
262243

263244
await GitHooksService.installHooks('/repo');
264245

@@ -300,9 +281,7 @@ describe('GitHooksService', () => {
300281

301282
await GitHooksService.installHooks('/repo');
302283

303-
expect(OrchestratorLogger.logWarning).toHaveBeenCalledWith(
304-
expect.stringContaining('Hook installation failed'),
305-
);
284+
expect(OrchestratorLogger.logWarning).toHaveBeenCalledWith(expect.stringContaining('Hook installation failed'));
306285
});
307286
});
308287

@@ -316,14 +295,8 @@ describe('GitHooksService', () => {
316295

317296
const results = await GitHooksService.runHookGroups('/repo', ['pre-commit', 'pre-push']);
318297

319-
expect(OrchestratorSystem.Run).toHaveBeenCalledWith(
320-
`cd "/repo" && npx lefthook run pre-commit`,
321-
true,
322-
);
323-
expect(OrchestratorSystem.Run).toHaveBeenCalledWith(
324-
`cd "/repo" && npx lefthook run pre-push`,
325-
true,
326-
);
298+
expect(OrchestratorSystem.Run).toHaveBeenCalledWith(`cd "/repo" && npx lefthook run pre-commit`, true);
299+
expect(OrchestratorSystem.Run).toHaveBeenCalledWith(`cd "/repo" && npx lefthook run pre-push`, true);
327300
expect(results['pre-commit']).toBe(true);
328301
expect(results['pre-push']).toBe(true);
329302
});
@@ -340,9 +313,7 @@ describe('GitHooksService', () => {
340313
const results = await GitHooksService.runHookGroups('/repo', ['pre-commit']);
341314

342315
expect(results).toEqual({});
343-
expect(OrchestratorLogger.logWarning).toHaveBeenCalledWith(
344-
expect.stringContaining('requires lefthook'),
345-
);
316+
expect(OrchestratorLogger.logWarning).toHaveBeenCalledWith(expect.stringContaining('requires lefthook'));
346317
});
347318

348319
it('should mark failed groups as false', async () => {
@@ -351,8 +322,7 @@ describe('GitHooksService', () => {
351322
return String(filePath).includes('lefthook.yml') && !String(filePath).startsWith('.');
352323
});
353324

354-
OrchestratorSystem.Run
355-
.mockResolvedValueOnce('') // pre-commit passes
325+
OrchestratorSystem.Run.mockResolvedValueOnce('') // pre-commit passes
356326
.mockRejectedValueOnce(new Error('tests failed')); // pre-push fails
357327

358328
const results = await GitHooksService.runHookGroups('/repo', ['pre-commit', 'pre-push']);
@@ -368,18 +338,12 @@ describe('GitHooksService', () => {
368338
return String(filePath).includes('lefthook.yml') && !String(filePath).startsWith('.');
369339
});
370340

371-
OrchestratorSystem.Run
372-
.mockResolvedValueOnce('')
373-
.mockRejectedValueOnce(new Error('check failed'));
341+
OrchestratorSystem.Run.mockResolvedValueOnce('').mockRejectedValueOnce(new Error('check failed'));
374342

375343
await GitHooksService.runHookGroups('/repo', ['pre-commit', 'commit-msg']);
376344

377-
expect(OrchestratorLogger.log).toHaveBeenCalledWith(
378-
expect.stringContaining("'pre-commit' passed"),
379-
);
380-
expect(OrchestratorLogger.logWarning).toHaveBeenCalledWith(
381-
expect.stringContaining("'commit-msg' failed"),
382-
);
345+
expect(OrchestratorLogger.log).toHaveBeenCalledWith(expect.stringContaining("'pre-commit' passed"));
346+
expect(OrchestratorLogger.logWarning).toHaveBeenCalledWith(expect.stringContaining("'commit-msg' failed"));
383347
});
384348
});
385349

@@ -429,9 +393,7 @@ describe('GitHooksService', () => {
429393

430394
await GitHooksService.disableHooks('/repo');
431395

432-
expect(OrchestratorLogger.logWarning).toHaveBeenCalledWith(
433-
expect.stringContaining('Failed to disable hooks'),
434-
);
396+
expect(OrchestratorLogger.logWarning).toHaveBeenCalledWith(expect.stringContaining('Failed to disable hooks'));
435397
});
436398
});
437399

src/model/orchestrator/services/hooks/git-hooks-service.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,7 @@ export class GitHooksService {
169169

170170
const framework = GitHooksService.detectHookFramework(repoPath);
171171
if (framework !== 'lefthook') {
172-
OrchestratorLogger.logWarning(
173-
`[GitHooks] runHookGroups requires lefthook, but detected: ${framework}`,
174-
);
172+
OrchestratorLogger.logWarning(`[GitHooks] runHookGroups requires lefthook, but detected: ${framework}`);
175173

176174
return results;
177175
}

0 commit comments

Comments
 (0)