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

share.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
  1. import request from 'supertest';
  2. import { runDbMigrations } from '../../src/migrate';
  3. import Eval from '../../src/models/eval';
  4. import { createApp } from '../../src/server/server';
  5. import results_v3 from './v3evalToShare.json';
  6. import results_v4 from './v4evalToShare.json';
  7. describe('share', () => {
  8. const app = createApp();
  9. beforeAll(async () => {
  10. await runDbMigrations();
  11. });
  12. it('should accept a version 3 results file', async () => {
  13. const res = await request(app).post('/api/eval').send(results_v3);
  14. expect(res.status).toBe(200);
  15. const eval_ = await Eval.findById(res.body.id as string);
  16. expect(eval_).not.toBeNull();
  17. expect(eval_?.version()).toBe(3);
  18. const results = await eval_?.getResults();
  19. expect(results).toHaveLength(8);
  20. });
  21. it('should accept a new eval', async () => {
  22. const res = await request(app).post('/api/eval').send(results_v4);
  23. expect(res.status).toBe(200);
  24. const eval_ = await Eval.findById(res.body.id as string);
  25. expect(eval_).not.toBeNull();
  26. expect(eval_?.version()).toBe(4);
  27. const results = await eval_?.getResults();
  28. expect(results).toHaveLength(8);
  29. });
  30. });
Tip!

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

Comments

Loading...