Files
cloud-mcp/tests/unit/tools/hobbies/football.test.ts

62 lines
1.6 KiB
TypeScript

/**
* Football tools tests
*/
import { describe, test, expect, beforeEach } from "bun:test";
import { registerFootballTools } from "../../../../src/tools/hobbies/football.js";
import { callTool } from "../../../helpers/tool-helper.js";
import { setTestEnv } from "../../../helpers/test-utils.js";
describe("Football Tools", () => {
let cleanupEnv: () => void;
beforeEach(() => {
cleanupEnv = setTestEnv({
FOOTBALL_API_KEY: "test-key",
});
registerFootballTools();
});
afterEach(() => {
cleanupEnv();
});
test("should get football matches", async () => {
const result = await callTool("football_matches", {
days: 7,
});
// Should return matches or placeholder message
expect(result.content[0].text).toBeDefined();
expect(result.content[0].text.length).toBeGreaterThan(0);
});
test("should get team information", async () => {
const result = await callTool("football_team_info", {
team: "Manchester United",
});
// Should return team info or placeholder
expect(result.content[0].text).toBeDefined();
});
test("should get league standings", async () => {
const result = await callTool("football_standings", {
league: "Premier League",
});
// Should return standings or placeholder
expect(result.content[0].text).toBeDefined();
});
test("should handle missing API key gracefully", async () => {
cleanupEnv();
cleanupEnv = setTestEnv({});
registerFootballTools();
const result = await callTool("football_matches", {});
expect(result.content[0].text).toContain("FOOTBALL_API_KEY");
});
});