import assert from "node:assert/strict";
import test from "node:test";

import { prefixTavilyTool } from "../extensions/tavily-tool-prefix.ts";

test("Tavily override prefixes tool identity and internal tool references", () => {
	const tool = prefixTavilyTool({
		name: "web_search",
		label: "Web Search",
		description: "Use web_search, then web_fetch with Tavily.",
		promptSnippet: "Call web_search.",
		promptGuidelines: ["Use web_fetch after web_search."],
		parameters: {} as never,
		execute: async () => ({ content: [{ type: "text" as const, text: "ok" }] }),
	});

	assert.equal(tool.name, "tavily_web_search");
	assert.equal(tool.label, "Tavily Web Search");
	assert.equal(tool.description, "Use tavily_web_search, then tavily_web_fetch with Tavily.");
	assert.equal(tool.promptSnippet, "Call tavily_web_search.");
	assert.deepEqual(tool.promptGuidelines, ["Use tavily_web_fetch after tavily_web_search."]);
});
