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

graders.test.ts 1.1 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
  1. import { getGraderById } from '../../src/redteam/graders';
  2. import { AsciiSmugglingGrader } from '../../src/redteam/plugins/asciiSmuggling';
  3. import { BeavertailsGrader } from '../../src/redteam/plugins/beavertails';
  4. import { HarmfulGrader } from '../../src/redteam/plugins/harmful/graders';
  5. describe('getGraderById', () => {
  6. it('should return correct grader for valid ID', () => {
  7. const asciiGrader = getGraderById('promptfoo:redteam:ascii-smuggling');
  8. expect(asciiGrader).toBeInstanceOf(AsciiSmugglingGrader);
  9. const beavertailsGrader = getGraderById('promptfoo:redteam:beavertails');
  10. expect(beavertailsGrader).toBeInstanceOf(BeavertailsGrader);
  11. const harmfulGrader = getGraderById('promptfoo:redteam:harmful');
  12. expect(harmfulGrader).toBeInstanceOf(HarmfulGrader);
  13. });
  14. it('should return undefined for invalid ID', () => {
  15. const invalidGrader = getGraderById('invalid-id');
  16. expect(invalidGrader).toBeUndefined();
  17. });
  18. it('should return undefined for empty ID', () => {
  19. const emptyGrader = getGraderById('');
  20. expect(emptyGrader).toBeUndefined();
  21. });
  22. });
Tip!

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

Comments

Loading...