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

listPrevious.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
28
29
30
31
32
33
34
35
36
37
38
39
  1. import { runDbMigrations } from '../../src/migrate';
  2. import { listPreviousResults } from '../../src/util';
  3. import EvalFactory from '../factories/evalFactory';
  4. describe('listPreviousResults', () => {
  5. beforeAll(async () => {
  6. await runDbMigrations();
  7. });
  8. it('returns previous results', async () => {
  9. const eval1 = await EvalFactory.create();
  10. const eval2 = await EvalFactory.create();
  11. const evalOld: any = await EvalFactory.createOldResult();
  12. const results = await listPreviousResults();
  13. expect(results).toHaveLength(3);
  14. expect(results).toContainEqual(
  15. expect.objectContaining({
  16. evalId: eval1.id,
  17. createdAt: eval1.createdAt,
  18. numTests: 2,
  19. }),
  20. );
  21. expect(results).toContainEqual(
  22. expect.objectContaining({
  23. evalId: eval2.id,
  24. createdAt: eval2.createdAt,
  25. description: eval2.description || null,
  26. numTests: 2,
  27. }),
  28. );
  29. expect(results).toContainEqual(
  30. expect.objectContaining({
  31. evalId: evalOld.id,
  32. createdAt: evalOld.createdAt,
  33. numTests: 1,
  34. }),
  35. );
  36. });
  37. });
Tip!

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

Comments

Loading...