mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-04 14:57:42 +00:00
test(tools): move get_location specs to specs/ and assert real tool registration
This commit is contained in:
parent
f2379f7327
commit
32808e5dd2
3 changed files with 12 additions and 20 deletions
|
|
@ -1,19 +0,0 @@
|
|||
const { Tool } = require('@librechat/agents/langchain/tools');
|
||||
const GetLocation = require('../GetLocation');
|
||||
|
||||
describe('get_location tool registration', () => {
|
||||
it('GetLocation is a Tool subclass so loadAndFormatTools discovers it', () => {
|
||||
expect(GetLocation.prototype instanceof Tool).toBe(true);
|
||||
});
|
||||
|
||||
it('can be instantiated with override for discovery without request context', () => {
|
||||
const tool = new GetLocation({ override: true });
|
||||
expect(tool.name).toBe('get_location');
|
||||
expect(tool.schema).toBeDefined();
|
||||
});
|
||||
|
||||
it('has a plain-object schema compatible with loadAndFormatTools (non-Zod)', () => {
|
||||
const tool = new GetLocation({ override: true });
|
||||
expect(tool.schema).toEqual({ type: 'object', properties: {}, required: [] });
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
const path = require('path');
|
||||
const { loadAndFormatTools } = require('~/server/services/start/tools');
|
||||
|
||||
describe('get_location tool registration', () => {
|
||||
it('is discovered by loadAndFormatTools so it shows in the picker and survives agent save', () => {
|
||||
const directory = path.resolve(__dirname, '..');
|
||||
const tools = loadAndFormatTools({ directory, adminFilter: [], adminIncluded: [] });
|
||||
expect(tools.get_location).toBeDefined();
|
||||
expect(tools.get_location.function.name).toBe('get_location');
|
||||
});
|
||||
});
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
const GetLocation = require('./GetLocation');
|
||||
const GetLocation = require('../GetLocation');
|
||||
|
||||
const makeReq = ({ location, featureEnabled = true } = {}) => ({
|
||||
config: { location: { enabled: featureEnabled } },
|
||||
Loading…
Add table
Add a link
Reference in a new issue