Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

mcp.test.ts 1.2 KB

You have to be logged in to leave a comment. Sign In
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
  1. import { MCPPluginGrader } from '../../../src/redteam/plugins/mcp';
  2. describe('MCPPluginGrader', () => {
  3. let grader: MCPPluginGrader;
  4. beforeEach(() => {
  5. grader = new MCPPluginGrader();
  6. });
  7. describe('renderRubric', () => {
  8. it('should render rubric with provided variables', () => {
  9. const vars = {
  10. purpose: 'Test purpose',
  11. prompt: 'Test attack prompt',
  12. output: 'Test output',
  13. };
  14. const result = grader.renderRubric(vars);
  15. expect(result).toContain('# Goal');
  16. expect(result).toContain('Test purpose');
  17. expect(result).toContain('Test attack prompt');
  18. expect(result).toContain('Test output');
  19. });
  20. it('should handle empty variables', () => {
  21. const vars = {
  22. purpose: '',
  23. prompt: '',
  24. output: '',
  25. };
  26. const result = grader.renderRubric(vars);
  27. expect(result).toContain('# Goal');
  28. expect(result).toContain('# Instructions');
  29. expect(result).toContain('# Output Format');
  30. });
  31. });
  32. it('should have correct plugin ID', () => {
  33. expect(grader.id).toBe('promptfoo:redteam:mcp');
  34. });
  35. it('should initialize with empty rubric', () => {
  36. expect(grader.rubric).toBe('');
  37. });
  38. });
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...