-
-
Notifications
You must be signed in to change notification settings - Fork 266
Expand file tree
/
Copy pathsession_show_defaults.test.ts
More file actions
49 lines (41 loc) · 1.51 KB
/
session_show_defaults.test.ts
File metadata and controls
49 lines (41 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { sessionStore } from '../../../../utils/session-store.ts';
import plugin from '../session_show_defaults.ts';
describe('session-show-defaults tool', () => {
beforeEach(() => {
sessionStore.clear();
});
afterEach(() => {
sessionStore.clear();
});
describe('Export Field Validation (Literal)', () => {
it('should have correct name', () => {
expect(plugin.name).toBe('session-show-defaults');
});
it('should have correct description', () => {
expect(plugin.description).toBe('Show current session defaults.');
});
it('should have handler function', () => {
expect(typeof plugin.handler).toBe('function');
});
it('should have empty schema', () => {
expect(plugin.schema).toEqual({});
});
});
describe('Handler Behavior', () => {
it('should return empty defaults when none set', async () => {
const result = await plugin.handler({});
expect(result.isError).toBe(false);
const parsed = JSON.parse(result.content[0].text);
expect(parsed).toEqual({});
});
it('should return current defaults when set', async () => {
sessionStore.setDefaults({ scheme: 'MyScheme', simulatorId: 'SIM-123' });
const result = await plugin.handler({});
expect(result.isError).toBe(false);
const parsed = JSON.parse(result.content[0].text);
expect(parsed.scheme).toBe('MyScheme');
expect(parsed.simulatorId).toBe('SIM-123');
});
});
});