Disallow redundant typecasts. (#15030)

This commit is contained in:
Christian Gunderman
2025-12-12 17:43:43 -08:00
committed by GitHub
parent fcc3b2b5ec
commit 942bcfc61e
86 changed files with 235 additions and 371 deletions
@@ -4,15 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import {
describe,
it,
expect,
vi,
beforeEach,
afterEach,
type Mock,
} from 'vitest';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { z } from 'zod';
@@ -90,7 +82,7 @@ describe('MCP Server Example', () => {
json: vi.fn().mockResolvedValue(mockPosts),
});
const toolFn = (mockRegisterTool as Mock).mock.calls[0][2];
const toolFn = mockRegisterTool.mock.calls[0][2];
const result = await toolFn();
expect(global.fetch).toHaveBeenCalledWith(
@@ -109,7 +101,7 @@ describe('MCP Server Example', () => {
describe('poem-writer prompt implementation', () => {
it('should generate a prompt with a title', () => {
const promptFn = (mockRegisterPrompt as Mock).mock.calls[0][2];
const promptFn = mockRegisterPrompt.mock.calls[0][2];
const result = promptFn({ title: 'My Poem' });
expect(result).toEqual({
messages: [
@@ -125,7 +117,7 @@ describe('MCP Server Example', () => {
});
it('should generate a prompt with a title and mood', () => {
const promptFn = (mockRegisterPrompt as Mock).mock.calls[0][2];
const promptFn = mockRegisterPrompt.mock.calls[0][2];
const result = promptFn({ title: 'My Poem', mood: 'sad' });
expect(result).toEqual({
messages: [