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

store.simple.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
40
41
42
43
44
45
46
47
48
  1. import { afterEach, beforeEach, describe, expect, it, jest } from '@jest/globals';
  2. import { TraceStore } from '../../src/tracing/store';
  3. // Mock the entire database module
  4. jest.mock('../../src/database', () => ({
  5. getDb: jest.fn(),
  6. }));
  7. // Mock the crypto module
  8. jest.mock('crypto', () => ({
  9. randomUUID: jest.fn(() => 'test-uuid'),
  10. }));
  11. // Mock logger
  12. jest.mock('../../src/logger', () => ({
  13. default: {
  14. debug: jest.fn(),
  15. error: jest.fn(),
  16. warn: jest.fn(),
  17. },
  18. }));
  19. describe('TraceStore (Simple)', () => {
  20. let traceStore: TraceStore;
  21. beforeEach(() => {
  22. jest.clearAllMocks();
  23. // Create a new instance for each test
  24. traceStore = new TraceStore();
  25. });
  26. afterEach(() => {
  27. jest.restoreAllMocks();
  28. });
  29. it('should be instantiable', () => {
  30. expect(traceStore).toBeInstanceOf(TraceStore);
  31. });
  32. it('should have all required methods', () => {
  33. expect(traceStore.createTrace).toBeDefined();
  34. expect(traceStore.addSpans).toBeDefined();
  35. expect(traceStore.getTracesByEvaluation).toBeDefined();
  36. expect(traceStore.getTrace).toBeDefined();
  37. expect(traceStore.deleteOldTraces).toBeDefined();
  38. });
  39. });
Tip!

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

Comments

Loading...