mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-01 14:26:17 -07:00
style: fix prettier formatting and eslint errors on test files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -1,5 +1,4 @@
|
||||
import { OrchestratorFolders } from './orchestrator-folders';
|
||||
import path from 'node:path';
|
||||
|
||||
// Mock Orchestrator
|
||||
jest.mock('../orchestrator', () => ({
|
||||
@@ -61,9 +60,7 @@ describe('OrchestratorFolders', () => {
|
||||
});
|
||||
|
||||
it('handles mixed slashes', () => {
|
||||
expect(OrchestratorFolders.ToLinuxFolder('some/path\\mixed/slashes\\here')).toBe(
|
||||
'some/path/mixed/slashes/here',
|
||||
);
|
||||
expect(OrchestratorFolders.ToLinuxFolder('some/path\\mixed/slashes\\here')).toBe('some/path/mixed/slashes/here');
|
||||
});
|
||||
|
||||
it('handles empty string', () => {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { FollowLogStreamService } from './follow-log-stream-service';
|
||||
import * as core from '@actions/core';
|
||||
import GitHub from '../../../github';
|
||||
|
||||
// Mock dependencies
|
||||
jest.mock('../../../github', () => ({
|
||||
@@ -39,9 +41,6 @@ jest.mock('./orchestrator-logger', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
import * as core from '@actions/core';
|
||||
import GitHub from '../../../github';
|
||||
|
||||
describe('FollowLogStreamService', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
@@ -59,23 +58,13 @@ describe('FollowLogStreamService', () => {
|
||||
|
||||
describe('handleIteration', () => {
|
||||
it('detects end of transmission marker', () => {
|
||||
const result = FollowLogStreamService.handleIteration(
|
||||
'---test-log-id-123',
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
);
|
||||
const result = FollowLogStreamService.handleIteration('---test-log-id-123', true, false, '');
|
||||
expect(FollowLogStreamService.DidReceiveEndOfTransmission).toBe(true);
|
||||
expect(result.shouldReadLogs).toBe(false);
|
||||
});
|
||||
|
||||
it('does not trigger end of transmission for non-matching log ID', () => {
|
||||
const result = FollowLogStreamService.handleIteration(
|
||||
'---different-log-id',
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
);
|
||||
const result = FollowLogStreamService.handleIteration('---different-log-id', true, false, '');
|
||||
expect(FollowLogStreamService.DidReceiveEndOfTransmission).toBe(false);
|
||||
expect(result.shouldReadLogs).toBe(true);
|
||||
});
|
||||
@@ -87,32 +76,19 @@ describe('FollowLogStreamService', () => {
|
||||
false,
|
||||
'',
|
||||
);
|
||||
expect(GitHub.updateGitHubCheck).toHaveBeenCalledWith(
|
||||
'Library was not found, importing new Library',
|
||||
'',
|
||||
);
|
||||
expect(GitHub.updateGitHubCheck).toHaveBeenCalledWith('Library was not found, importing new Library', '');
|
||||
expect(core.warning).toHaveBeenCalledWith('LIBRARY NOT FOUND!');
|
||||
expect(core.setOutput).toHaveBeenCalledWith('library-found', 'false');
|
||||
});
|
||||
|
||||
it('detects Build succeeded message', () => {
|
||||
FollowLogStreamService.handleIteration(
|
||||
'Build succeeded',
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
);
|
||||
FollowLogStreamService.handleIteration('Build succeeded', true, false, '');
|
||||
expect(GitHub.updateGitHubCheck).toHaveBeenCalledWith('Build succeeded', 'Build succeeded');
|
||||
expect(core.setOutput).toHaveBeenCalledWith('build-result', 'success');
|
||||
});
|
||||
|
||||
it('detects Build fail message', () => {
|
||||
FollowLogStreamService.handleIteration(
|
||||
'Build fail',
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
);
|
||||
FollowLogStreamService.handleIteration('Build fail', true, false, '');
|
||||
expect(GitHub.updateGitHubCheck).toHaveBeenCalled();
|
||||
expect(core.setOutput).toHaveBeenCalledWith('build-result', 'failed');
|
||||
expect(core.setFailed).toHaveBeenCalledWith('unity build failed');
|
||||
@@ -120,95 +96,50 @@ describe('FollowLogStreamService', () => {
|
||||
});
|
||||
|
||||
it('accumulates error messages with "error " pattern', () => {
|
||||
FollowLogStreamService.handleIteration(
|
||||
'error CS0001: Something went wrong',
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
);
|
||||
FollowLogStreamService.handleIteration('error CS0001: Something went wrong', true, false, '');
|
||||
expect(FollowLogStreamService.errors).toContain('error CS0001: Something went wrong');
|
||||
expect(core.error).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('accumulates error messages with "error: " pattern', () => {
|
||||
FollowLogStreamService.handleIteration(
|
||||
'Fatal Error: Out of memory',
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
);
|
||||
FollowLogStreamService.handleIteration('Fatal Error: Out of memory', true, false, '');
|
||||
expect(FollowLogStreamService.errors).toContain('Fatal Error: Out of memory');
|
||||
});
|
||||
|
||||
it('accumulates "command failed: " messages', () => {
|
||||
FollowLogStreamService.handleIteration(
|
||||
'command failed: git pull',
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
);
|
||||
FollowLogStreamService.handleIteration('command failed: git pull', true, false, '');
|
||||
expect(FollowLogStreamService.errors).toContain('command failed: git pull');
|
||||
});
|
||||
|
||||
it('accumulates "invalid " messages', () => {
|
||||
FollowLogStreamService.handleIteration(
|
||||
'invalid configuration value',
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
);
|
||||
FollowLogStreamService.handleIteration('invalid configuration value', true, false, '');
|
||||
expect(FollowLogStreamService.errors).toContain('invalid configuration value');
|
||||
});
|
||||
|
||||
it('accumulates "cannot be found" messages', () => {
|
||||
FollowLogStreamService.handleIteration(
|
||||
'Assembly cannot be found',
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
);
|
||||
FollowLogStreamService.handleIteration('Assembly cannot be found', true, false, '');
|
||||
expect(FollowLogStreamService.errors).toContain('Assembly cannot be found');
|
||||
});
|
||||
|
||||
it('appends message to output', () => {
|
||||
const result = FollowLogStreamService.handleIteration(
|
||||
'Some normal log line',
|
||||
true,
|
||||
false,
|
||||
'previous output\n',
|
||||
);
|
||||
const result = FollowLogStreamService.handleIteration('Some normal log line', true, false, 'previous output\n');
|
||||
expect(result.output).toContain('Some normal log line');
|
||||
expect(result.output).toContain('previous output');
|
||||
});
|
||||
|
||||
it('preserves shouldCleanup value', () => {
|
||||
const result = FollowLogStreamService.handleIteration(
|
||||
'normal message',
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
);
|
||||
const result = FollowLogStreamService.handleIteration('normal message', true, true, '');
|
||||
expect(result.shouldCleanup).toBe(true);
|
||||
});
|
||||
|
||||
it('does not change shouldReadLogs for normal messages', () => {
|
||||
const result = FollowLogStreamService.handleIteration(
|
||||
'Just a regular build log',
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
);
|
||||
const result = FollowLogStreamService.handleIteration('Just a regular build log', true, false, '');
|
||||
expect(result.shouldReadLogs).toBe(true);
|
||||
});
|
||||
|
||||
it('includes accumulated errors in Build fail GitHub check message', () => {
|
||||
FollowLogStreamService.errors = '\nprevious error';
|
||||
FollowLogStreamService.handleIteration(
|
||||
'Build fail',
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
);
|
||||
FollowLogStreamService.handleIteration('Build fail', true, false, '');
|
||||
const updateCall = (GitHub.updateGitHubCheck as jest.Mock).mock.calls[0];
|
||||
expect(updateCall[0]).toContain('previous error');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user