test: add type assertion to bypass type check
This commit is contained in:
parent
fc9ca5ff2e
commit
08808a45e0
2 changed files with 3 additions and 2 deletions
|
|
@ -43,7 +43,7 @@ server.registerTool(
|
|||
void country;
|
||||
// Simulate weather API call
|
||||
const temp_c = Math.round((Math.random() * 35 - 5) * 10) / 10;
|
||||
const conditions = ["sunny", "cloudy", "rainy", "stormy", "snowy"][Math.floor(Math.random() * 5)];
|
||||
const conditions = ["sunny", "cloudy", "rainy", "stormy", "snowy"][Math.floor(Math.random() * 5)] as unknown as "sunny" | "cloudy" | "rainy" | "stormy" | "snowy";
|
||||
|
||||
const structuredContent = {
|
||||
temperature: {
|
||||
|
|
@ -77,4 +77,4 @@ async function main() {
|
|||
main().catch((error) => {
|
||||
console.error("Server error:", error);
|
||||
process.exit(1);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1248,6 +1248,7 @@ describe("tool()", () => {
|
|||
processedInput: input,
|
||||
resultType: "structured",
|
||||
// Missing required 'timestamp' field
|
||||
someExtraField: "unexpected" // Extra field not in schema
|
||||
} as unknown as { processedInput: string; resultType: string; timestamp: string }, // Type assertion to bypass TypeScript validation for testing purposes
|
||||
})
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue