mirror of https://github.com/buster-so/buster.git
refactor: update web search tool integration tests and improve code formatting
- Changed test query from 'OpenAI GPT' to 'Buster Data' with an increased limit of 10. - Reorganized import statements in web-search-tool.ts for better readability. - Enhanced formatting in permission-validator.test.ts for improved code clarity.
This commit is contained in:
parent
341b97f351
commit
9e67fbfaae
|
@ -13,8 +13,8 @@ describe('webSearch tool integration', () => {
|
|||
async () => {
|
||||
const result = await webSearch.execute({
|
||||
context: {
|
||||
query: 'OpenAI GPT',
|
||||
limit: 3,
|
||||
query: 'Buster Data',
|
||||
limit: 10,
|
||||
scrapeContent: true,
|
||||
formats: ['markdown'],
|
||||
},
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { createTool } from '@mastra/core/tools';
|
||||
import type { RuntimeContext } from '@mastra/core/runtime-context';
|
||||
import { wrapTraced } from 'braintrust';
|
||||
import { z } from 'zod';
|
||||
import {
|
||||
FirecrawlService,
|
||||
type WebSearchOptions,
|
||||
type WebSearchResult,
|
||||
} from '@buster-tools/web-tools';
|
||||
import type { RuntimeContext } from '@mastra/core/runtime-context';
|
||||
import { createTool } from '@mastra/core/tools';
|
||||
import { wrapTraced } from 'braintrust';
|
||||
import { z } from 'zod';
|
||||
|
||||
const inputSchema = z.object({
|
||||
query: z.string().min(1, 'Search query is required').describe('The search query to execute'),
|
||||
|
|
|
@ -51,7 +51,10 @@ describe('Permission Validator', () => {
|
|||
},
|
||||
] as any);
|
||||
|
||||
const result = await validateSqlPermissions('SELECT id, user_id FROM public.orders', 'user123');
|
||||
const result = await validateSqlPermissions(
|
||||
'SELECT id, user_id FROM public.orders',
|
||||
'user123'
|
||||
);
|
||||
|
||||
expect(result).toEqual({
|
||||
isAuthorized: false,
|
||||
|
|
|
@ -196,10 +196,7 @@ export class FirecrawlService {
|
|||
/**
|
||||
* Search the web using Firecrawl's search endpoint
|
||||
*/
|
||||
async webSearch(
|
||||
query: string,
|
||||
options?: WebSearchOptions
|
||||
): Promise<WebSearchResponse> {
|
||||
async webSearch(query: string, options?: WebSearchOptions): Promise<WebSearchResponse> {
|
||||
try {
|
||||
const searchOptions = {
|
||||
limit: options?.limit || 5,
|
||||
|
|
Loading…
Reference in New Issue