import assert from "node:assert/strict";
import { test } from "vitest";
import { resultForZeroToolCallGuard } from "../auto/phases-unit.js";

test("zeroToolGuard_when_solver_pass_replaces_result_uses_current_result", () => {
	const executorResult = {
		status: "completed",
		_via: "swarm",
		swarmToolCallCount: 0,
	};
	const solverResult = {
		status: "completed",
		_via: "swarm",
		swarmToolCallCount: 1,
	};

	assert.equal(
		resultForZeroToolCallGuard(executorResult, solverResult),
		solverResult,
	);
});

test("zeroToolGuard_when_no_solver_result_uses_original_result", () => {
	const executorResult = {
		status: "completed",
		_via: "swarm",
		swarmToolCallCount: 0,
	};

	assert.equal(
		resultForZeroToolCallGuard(executorResult, null),
		executorResult,
	);
});
