chore(#1): apply Prettier formatting to all source and test files
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi, afterEach } from 'vitest';
|
||||
import { EventBuilder } from '../src/event-builder.js';
|
||||
import { ResolvedConfig } from '../src/config.js';
|
||||
import { describe, it, expect, vi, afterEach } from "vitest";
|
||||
import { EventBuilder } from "../src/event-builder.js";
|
||||
import { ResolvedConfig } from "../src/config.js";
|
||||
import {
|
||||
TaskType,
|
||||
Complexity,
|
||||
@@ -9,13 +9,13 @@ import {
|
||||
Outcome,
|
||||
QualityGate,
|
||||
RepoSizeCategory,
|
||||
} from '../src/types/events.js';
|
||||
} from "../src/types/events.js";
|
||||
|
||||
function makeConfig(): ResolvedConfig {
|
||||
return {
|
||||
serverUrl: 'https://tel.example.com',
|
||||
apiKey: 'a'.repeat(64),
|
||||
instanceId: 'my-instance-uuid',
|
||||
serverUrl: "https://tel.example.com",
|
||||
apiKey: "a".repeat(64),
|
||||
instanceId: "my-instance-uuid",
|
||||
enabled: true,
|
||||
submitIntervalMs: 300_000,
|
||||
maxQueueSize: 1000,
|
||||
@@ -28,19 +28,19 @@ function makeConfig(): ResolvedConfig {
|
||||
};
|
||||
}
|
||||
|
||||
describe('EventBuilder', () => {
|
||||
describe("EventBuilder", () => {
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('should build a complete TaskCompletionEvent', () => {
|
||||
it("should build a complete TaskCompletionEvent", () => {
|
||||
const builder = new EventBuilder(makeConfig());
|
||||
const event = builder.build({
|
||||
task_duration_ms: 15000,
|
||||
task_type: TaskType.IMPLEMENTATION,
|
||||
complexity: Complexity.HIGH,
|
||||
harness: Harness.CLAUDE_CODE,
|
||||
model: 'claude-3-opus',
|
||||
model: "claude-3-opus",
|
||||
provider: Provider.ANTHROPIC,
|
||||
estimated_input_tokens: 2000,
|
||||
estimated_output_tokens: 1000,
|
||||
@@ -49,37 +49,41 @@ describe('EventBuilder', () => {
|
||||
estimated_cost_usd_micros: 100000,
|
||||
actual_cost_usd_micros: 110000,
|
||||
quality_gate_passed: true,
|
||||
quality_gates_run: [QualityGate.BUILD, QualityGate.TEST, QualityGate.LINT],
|
||||
quality_gates_run: [
|
||||
QualityGate.BUILD,
|
||||
QualityGate.TEST,
|
||||
QualityGate.LINT,
|
||||
],
|
||||
quality_gates_failed: [],
|
||||
context_compactions: 2,
|
||||
context_rotations: 1,
|
||||
context_utilization_final: 0.75,
|
||||
outcome: Outcome.SUCCESS,
|
||||
retry_count: 0,
|
||||
language: 'typescript',
|
||||
language: "typescript",
|
||||
repo_size_category: RepoSizeCategory.MEDIUM,
|
||||
});
|
||||
|
||||
expect(event.task_type).toBe(TaskType.IMPLEMENTATION);
|
||||
expect(event.complexity).toBe(Complexity.HIGH);
|
||||
expect(event.model).toBe('claude-3-opus');
|
||||
expect(event.model).toBe("claude-3-opus");
|
||||
expect(event.quality_gates_run).toEqual([
|
||||
QualityGate.BUILD,
|
||||
QualityGate.TEST,
|
||||
QualityGate.LINT,
|
||||
]);
|
||||
expect(event.language).toBe('typescript');
|
||||
expect(event.language).toBe("typescript");
|
||||
expect(event.repo_size_category).toBe(RepoSizeCategory.MEDIUM);
|
||||
});
|
||||
|
||||
it('should auto-generate event_id as UUID', () => {
|
||||
it("should auto-generate event_id as UUID", () => {
|
||||
const builder = new EventBuilder(makeConfig());
|
||||
const event = builder.build({
|
||||
task_duration_ms: 1000,
|
||||
task_type: TaskType.TESTING,
|
||||
complexity: Complexity.LOW,
|
||||
harness: Harness.AIDER,
|
||||
model: 'gpt-4',
|
||||
model: "gpt-4",
|
||||
provider: Provider.OPENAI,
|
||||
estimated_input_tokens: 100,
|
||||
estimated_output_tokens: 50,
|
||||
@@ -108,7 +112,7 @@ describe('EventBuilder', () => {
|
||||
task_type: TaskType.TESTING,
|
||||
complexity: Complexity.LOW,
|
||||
harness: Harness.AIDER,
|
||||
model: 'gpt-4',
|
||||
model: "gpt-4",
|
||||
provider: Provider.OPENAI,
|
||||
estimated_input_tokens: 100,
|
||||
estimated_output_tokens: 50,
|
||||
@@ -129,8 +133,8 @@ describe('EventBuilder', () => {
|
||||
expect(event.event_id).not.toBe(event2.event_id);
|
||||
});
|
||||
|
||||
it('should auto-set timestamp to ISO 8601', () => {
|
||||
const now = new Date('2026-02-07T10:00:00.000Z');
|
||||
it("should auto-set timestamp to ISO 8601", () => {
|
||||
const now = new Date("2026-02-07T10:00:00.000Z");
|
||||
vi.setSystemTime(now);
|
||||
|
||||
const builder = new EventBuilder(makeConfig());
|
||||
@@ -139,7 +143,7 @@ describe('EventBuilder', () => {
|
||||
task_type: TaskType.DEBUGGING,
|
||||
complexity: Complexity.MEDIUM,
|
||||
harness: Harness.OPENCODE,
|
||||
model: 'claude-3-sonnet',
|
||||
model: "claude-3-sonnet",
|
||||
provider: Provider.ANTHROPIC,
|
||||
estimated_input_tokens: 500,
|
||||
estimated_output_tokens: 200,
|
||||
@@ -157,10 +161,10 @@ describe('EventBuilder', () => {
|
||||
retry_count: 1,
|
||||
});
|
||||
|
||||
expect(event.timestamp).toBe('2026-02-07T10:00:00.000Z');
|
||||
expect(event.timestamp).toBe("2026-02-07T10:00:00.000Z");
|
||||
});
|
||||
|
||||
it('should set instance_id from config', () => {
|
||||
it("should set instance_id from config", () => {
|
||||
const config = makeConfig();
|
||||
const builder = new EventBuilder(config);
|
||||
const event = builder.build({
|
||||
@@ -168,7 +172,7 @@ describe('EventBuilder', () => {
|
||||
task_type: TaskType.PLANNING,
|
||||
complexity: Complexity.LOW,
|
||||
harness: Harness.UNKNOWN,
|
||||
model: 'test-model',
|
||||
model: "test-model",
|
||||
provider: Provider.UNKNOWN,
|
||||
estimated_input_tokens: 0,
|
||||
estimated_output_tokens: 0,
|
||||
@@ -186,17 +190,17 @@ describe('EventBuilder', () => {
|
||||
retry_count: 0,
|
||||
});
|
||||
|
||||
expect(event.instance_id).toBe('my-instance-uuid');
|
||||
expect(event.instance_id).toBe("my-instance-uuid");
|
||||
});
|
||||
|
||||
it('should set schema_version to 1.0', () => {
|
||||
it("should set schema_version to 1.0", () => {
|
||||
const builder = new EventBuilder(makeConfig());
|
||||
const event = builder.build({
|
||||
task_duration_ms: 1000,
|
||||
task_type: TaskType.REFACTORING,
|
||||
complexity: Complexity.CRITICAL,
|
||||
harness: Harness.KILO_CODE,
|
||||
model: 'gemini-pro',
|
||||
model: "gemini-pro",
|
||||
provider: Provider.GOOGLE,
|
||||
estimated_input_tokens: 3000,
|
||||
estimated_output_tokens: 2000,
|
||||
@@ -214,6 +218,6 @@ describe('EventBuilder', () => {
|
||||
retry_count: 0,
|
||||
});
|
||||
|
||||
expect(event.schema_version).toBe('1.0');
|
||||
expect(event.schema_version).toBe("1.0");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user