projax 3.3.58 → 3.3.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +10 -1
  2. package/dist/electron/preload.d.ts +1 -0
  3. package/dist/electron/renderer/assets/index-CmtZriN5.js +66 -0
  4. package/dist/electron/renderer/index.html +1 -1
  5. package/dist/electron/script-runner.js +52 -20
  6. package/dist/index.js +14 -10
  7. package/dist/prxi.js +877 -109
  8. package/dist/prxi.tsx +1249 -177
  9. package/dist/script-runner.js +52 -20
  10. package/package.json +1 -1
  11. package/coverage/base.css +0 -224
  12. package/coverage/block-navigation.js +0 -87
  13. package/coverage/core-bridge.ts.html +0 -292
  14. package/coverage/favicon.png +0 -0
  15. package/coverage/index.html +0 -191
  16. package/coverage/lcov-report/base.css +0 -224
  17. package/coverage/lcov-report/block-navigation.js +0 -87
  18. package/coverage/lcov-report/core-bridge.ts.html +0 -292
  19. package/coverage/lcov-report/favicon.png +0 -0
  20. package/coverage/lcov-report/index.html +0 -191
  21. package/coverage/lcov-report/port-extractor.ts.html +0 -1174
  22. package/coverage/lcov-report/port-scanner.ts.html +0 -301
  23. package/coverage/lcov-report/port-utils.ts.html +0 -670
  24. package/coverage/lcov-report/prettify.css +0 -1
  25. package/coverage/lcov-report/prettify.js +0 -2
  26. package/coverage/lcov-report/script-runner.ts.html +0 -3346
  27. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  28. package/coverage/lcov-report/sorter.js +0 -210
  29. package/coverage/lcov-report/test-parser.ts.html +0 -799
  30. package/coverage/lcov.info +0 -1338
  31. package/coverage/port-extractor.ts.html +0 -1174
  32. package/coverage/port-scanner.ts.html +0 -301
  33. package/coverage/port-utils.ts.html +0 -670
  34. package/coverage/prettify.css +0 -1
  35. package/coverage/prettify.js +0 -2
  36. package/coverage/script-runner.ts.html +0 -3346
  37. package/coverage/sort-arrow-sprite.png +0 -0
  38. package/coverage/sorter.js +0 -210
  39. package/coverage/test-parser.ts.html +0 -799
  40. package/dist/__tests__/core-bridge.test.d.ts +0 -1
  41. package/dist/__tests__/core-bridge.test.js +0 -135
  42. package/dist/__tests__/port-extractor.test.d.ts +0 -1
  43. package/dist/__tests__/port-extractor.test.js +0 -407
  44. package/dist/__tests__/port-scanner.test.d.ts +0 -1
  45. package/dist/__tests__/port-scanner.test.js +0 -170
  46. package/dist/__tests__/port-utils.test.d.ts +0 -1
  47. package/dist/__tests__/port-utils.test.js +0 -127
  48. package/dist/__tests__/script-runner.test.d.ts +0 -1
  49. package/dist/__tests__/script-runner.test.js +0 -491
  50. package/dist/__tests__/test-parser.test.d.ts +0 -1
  51. package/dist/__tests__/test-parser.test.js +0 -276
  52. package/dist/api/__tests__/database.test.d.ts +0 -2
  53. package/dist/api/__tests__/database.test.d.ts.map +0 -1
  54. package/dist/api/__tests__/database.test.js +0 -485
  55. package/dist/api/__tests__/database.test.js.map +0 -1
  56. package/dist/api/__tests__/routes.test.d.ts +0 -2
  57. package/dist/api/__tests__/routes.test.d.ts.map +0 -1
  58. package/dist/api/__tests__/routes.test.js +0 -484
  59. package/dist/api/__tests__/routes.test.js.map +0 -1
  60. package/dist/api/__tests__/scanner.test.d.ts +0 -2
  61. package/dist/api/__tests__/scanner.test.d.ts.map +0 -1
  62. package/dist/api/__tests__/scanner.test.js +0 -403
  63. package/dist/api/__tests__/scanner.test.js.map +0 -1
  64. package/dist/core/__tests__/database.test.d.ts +0 -1
  65. package/dist/core/__tests__/database.test.js +0 -557
  66. package/dist/core/__tests__/detector.test.d.ts +0 -1
  67. package/dist/core/__tests__/detector.test.js +0 -375
  68. package/dist/core/__tests__/index.test.d.ts +0 -1
  69. package/dist/core/__tests__/index.test.js +0 -469
  70. package/dist/core/__tests__/scanner.test.d.ts +0 -1
  71. package/dist/core/__tests__/scanner.test.js +0 -406
  72. package/dist/core/__tests__/settings.test.d.ts +0 -1
  73. package/dist/core/__tests__/settings.test.js +0 -280
  74. package/dist/electron/core/__tests__/database.test.d.ts +0 -1
  75. package/dist/electron/core/__tests__/database.test.js +0 -557
  76. package/dist/electron/core/__tests__/detector.test.d.ts +0 -1
  77. package/dist/electron/core/__tests__/detector.test.js +0 -375
  78. package/dist/electron/core/__tests__/index.test.d.ts +0 -1
  79. package/dist/electron/core/__tests__/index.test.js +0 -469
  80. package/dist/electron/core/__tests__/scanner.test.d.ts +0 -1
  81. package/dist/electron/core/__tests__/scanner.test.js +0 -406
  82. package/dist/electron/core/__tests__/settings.test.d.ts +0 -1
  83. package/dist/electron/core/__tests__/settings.test.js +0 -280
  84. package/jest.config.js +0 -26
@@ -1,557 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- const fs = __importStar(require("fs"));
37
- const os = __importStar(require("os"));
38
- const path = __importStar(require("path"));
39
- const child_process_1 = require("child_process");
40
- const database_1 = require("../database");
41
- // Mock modules
42
- jest.mock('fs');
43
- jest.mock('child_process');
44
- const mockedFs = fs;
45
- const mockedExecSync = child_process_1.execSync;
46
- describe('database', () => {
47
- const dataDir = path.join(os.homedir(), '.projax');
48
- const portFile = path.join(dataDir, 'api-port.txt');
49
- const defaultPort = 38124;
50
- beforeEach(() => {
51
- jest.clearAllMocks();
52
- });
53
- describe('DatabaseManager constructor', () => {
54
- it('should initialize database manager', () => {
55
- mockedFs.existsSync.mockReturnValue(false);
56
- const db = (0, database_1.getDatabaseManager)();
57
- expect(db).toBeDefined();
58
- expect(typeof db.getAllProjects).toBe('function');
59
- expect(typeof db.addProject).toBe('function');
60
- });
61
- it('should handle port file configuration', () => {
62
- // This test verifies the DatabaseManager can be initialized
63
- // regardless of port file existence
64
- mockedFs.existsSync.mockReturnValue(false);
65
- const db = (0, database_1.getDatabaseManager)();
66
- expect(db).toBeDefined();
67
- });
68
- it('should be resilient to file system errors', () => {
69
- // Even if existsSync throws, the module should handle it gracefully
70
- mockedFs.existsSync.mockImplementation(() => {
71
- // Silently fail - use default
72
- return false;
73
- });
74
- const db = (0, database_1.getDatabaseManager)();
75
- expect(db).toBeDefined();
76
- });
77
- });
78
- describe('Project operations', () => {
79
- beforeEach(() => {
80
- mockedFs.existsSync.mockReturnValue(false);
81
- });
82
- describe('addProject', () => {
83
- it('should add a project successfully', () => {
84
- const mockProject = {
85
- id: 1,
86
- name: 'Test Project',
87
- path: '/test/path',
88
- description: null,
89
- framework: null,
90
- last_scanned: null,
91
- created_at: Date.now(),
92
- };
93
- mockedExecSync.mockReturnValue(JSON.stringify(mockProject));
94
- const db = (0, database_1.getDatabaseManager)();
95
- const result = db.addProject('Test Project', '/test/path');
96
- expect(result).toEqual(mockProject);
97
- expect(mockedExecSync).toHaveBeenCalledWith(expect.stringContaining('curl -s -f -X POST'), expect.any(Object));
98
- });
99
- it('should handle API errors', () => {
100
- mockedExecSync.mockImplementation(() => {
101
- throw new Error('API request failed');
102
- });
103
- const db = (0, database_1.getDatabaseManager)();
104
- expect(() => db.addProject('Test', '/path')).toThrow();
105
- });
106
- });
107
- describe('getProject', () => {
108
- it('should get a project by id', () => {
109
- const mockProject = {
110
- id: 1,
111
- name: 'Test Project',
112
- path: '/test/path',
113
- description: null,
114
- framework: 'react',
115
- last_scanned: null,
116
- created_at: Date.now(),
117
- };
118
- mockedExecSync.mockReturnValue(JSON.stringify(mockProject));
119
- const db = (0, database_1.getDatabaseManager)();
120
- const result = db.getProject(1);
121
- expect(result).toEqual(mockProject);
122
- });
123
- it('should return null for 404 errors', () => {
124
- mockedExecSync.mockImplementation(() => {
125
- const error = new Error('curl failed with 404 status');
126
- throw error;
127
- });
128
- const db = (0, database_1.getDatabaseManager)();
129
- expect(() => db.getProject(999)).toThrow();
130
- });
131
- });
132
- describe('getAllProjects', () => {
133
- it('should get all projects', () => {
134
- const mockProjects = [
135
- {
136
- id: 1,
137
- name: 'Project 1',
138
- path: '/path/1',
139
- description: null,
140
- framework: 'react',
141
- last_scanned: null,
142
- created_at: Date.now(),
143
- },
144
- {
145
- id: 2,
146
- name: 'Project 2',
147
- path: '/path/2',
148
- description: null,
149
- framework: 'vue',
150
- last_scanned: null,
151
- created_at: Date.now(),
152
- },
153
- ];
154
- mockedExecSync.mockReturnValue(JSON.stringify(mockProjects));
155
- const db = (0, database_1.getDatabaseManager)();
156
- const result = db.getAllProjects();
157
- expect(result).toEqual(mockProjects);
158
- expect(result.length).toBe(2);
159
- });
160
- it('should return empty array when no projects exist', () => {
161
- mockedExecSync.mockReturnValue(JSON.stringify([]));
162
- const db = (0, database_1.getDatabaseManager)();
163
- const result = db.getAllProjects();
164
- expect(result).toEqual([]);
165
- });
166
- });
167
- describe('getProjectByPath', () => {
168
- it('should find project by path', () => {
169
- const mockProjects = [
170
- {
171
- id: 1,
172
- name: 'Project 1',
173
- path: '/path/1',
174
- description: null,
175
- framework: null,
176
- last_scanned: null,
177
- created_at: Date.now(),
178
- },
179
- {
180
- id: 2,
181
- name: 'Project 2',
182
- path: '/path/2',
183
- description: null,
184
- framework: null,
185
- last_scanned: null,
186
- created_at: Date.now(),
187
- },
188
- ];
189
- mockedExecSync.mockReturnValue(JSON.stringify(mockProjects));
190
- const db = (0, database_1.getDatabaseManager)();
191
- const result = db.getProjectByPath('/path/2');
192
- expect(result).toEqual(mockProjects[1]);
193
- });
194
- it('should return null if project path not found', () => {
195
- mockedExecSync.mockReturnValue(JSON.stringify([]));
196
- const db = (0, database_1.getDatabaseManager)();
197
- const result = db.getProjectByPath('/nonexistent');
198
- expect(result).toBeNull();
199
- });
200
- });
201
- describe('updateProject', () => {
202
- it('should update project successfully', () => {
203
- const updatedProject = {
204
- id: 1,
205
- name: 'Updated Name',
206
- path: '/test/path',
207
- description: 'New description',
208
- framework: 'react',
209
- last_scanned: Date.now(),
210
- created_at: Date.now() - 1000,
211
- };
212
- mockedExecSync.mockReturnValue(JSON.stringify(updatedProject));
213
- const db = (0, database_1.getDatabaseManager)();
214
- const result = db.updateProject(1, { name: 'Updated Name', description: 'New description' });
215
- expect(result).toEqual(updatedProject);
216
- });
217
- });
218
- describe('updateProjectName', () => {
219
- it('should update project name', () => {
220
- const updatedProject = {
221
- id: 1,
222
- name: 'New Name',
223
- path: '/test/path',
224
- description: null,
225
- framework: null,
226
- last_scanned: null,
227
- created_at: Date.now(),
228
- };
229
- mockedExecSync.mockReturnValue(JSON.stringify(updatedProject));
230
- const db = (0, database_1.getDatabaseManager)();
231
- const result = db.updateProjectName(1, 'New Name');
232
- expect(result.name).toBe('New Name');
233
- });
234
- });
235
- describe('updateProjectFramework', () => {
236
- it('should update project framework', () => {
237
- mockedExecSync.mockReturnValue('');
238
- const db = (0, database_1.getDatabaseManager)();
239
- expect(() => db.updateProjectFramework(1, 'react')).not.toThrow();
240
- });
241
- });
242
- describe('removeProject', () => {
243
- it('should remove project successfully', () => {
244
- mockedExecSync.mockReturnValue('');
245
- const db = (0, database_1.getDatabaseManager)();
246
- expect(() => db.removeProject(1)).not.toThrow();
247
- expect(mockedExecSync).toHaveBeenCalledWith(expect.stringContaining('DELETE'), expect.any(Object));
248
- });
249
- });
250
- describe('scanProject', () => {
251
- it('should scan project and return results', () => {
252
- const scanResponse = {
253
- project: {
254
- id: 1,
255
- name: 'Test Project',
256
- path: '/test/path',
257
- description: null,
258
- framework: 'jest',
259
- last_scanned: Date.now(),
260
- created_at: Date.now(),
261
- },
262
- testsFound: 2,
263
- tests: [
264
- {
265
- id: 1,
266
- project_id: 1,
267
- file_path: '/test/file1.test.ts',
268
- framework: 'jest',
269
- status: null,
270
- last_run: null,
271
- created_at: Date.now(),
272
- },
273
- {
274
- id: 2,
275
- project_id: 1,
276
- file_path: '/test/file2.test.ts',
277
- framework: 'jest',
278
- status: null,
279
- last_run: null,
280
- created_at: Date.now(),
281
- },
282
- ],
283
- };
284
- mockedExecSync.mockReturnValue(JSON.stringify(scanResponse));
285
- const db = (0, database_1.getDatabaseManager)();
286
- const result = db.scanProject(1);
287
- expect(result.testsFound).toBe(2);
288
- expect(result.tests.length).toBe(2);
289
- });
290
- });
291
- describe('scanAllProjects', () => {
292
- it('should scan all projects', () => {
293
- const scanResults = [
294
- {
295
- project: {
296
- id: 1,
297
- name: 'Project 1',
298
- path: '/path/1',
299
- description: null,
300
- framework: null,
301
- last_scanned: Date.now(),
302
- created_at: Date.now(),
303
- },
304
- testsFound: 1,
305
- tests: [],
306
- },
307
- ];
308
- mockedExecSync.mockReturnValue(JSON.stringify(scanResults));
309
- const db = (0, database_1.getDatabaseManager)();
310
- const result = db.scanAllProjects();
311
- expect(result).toEqual(scanResults);
312
- });
313
- });
314
- });
315
- describe('Test operations', () => {
316
- beforeEach(() => {
317
- mockedFs.existsSync.mockReturnValue(false);
318
- });
319
- describe('getTestsByProject', () => {
320
- it('should get tests for a project', () => {
321
- const mockTests = [
322
- {
323
- id: 1,
324
- project_id: 1,
325
- file_path: '/test/file.test.ts',
326
- framework: 'jest',
327
- status: null,
328
- last_run: null,
329
- created_at: Date.now(),
330
- },
331
- ];
332
- mockedExecSync.mockReturnValue(JSON.stringify(mockTests));
333
- const db = (0, database_1.getDatabaseManager)();
334
- const result = db.getTestsByProject(1);
335
- expect(result).toEqual(mockTests);
336
- });
337
- });
338
- describe('addTest', () => {
339
- it('should throw error when called directly', () => {
340
- const db = (0, database_1.getDatabaseManager)();
341
- expect(() => db.addTest(1, '/test/file.test.ts')).toThrow('addTest should not be called directly');
342
- });
343
- });
344
- describe('getTest', () => {
345
- it('should throw error as endpoint not implemented', () => {
346
- const db = (0, database_1.getDatabaseManager)();
347
- expect(() => db.getTest(1)).toThrow('not yet implemented');
348
- });
349
- });
350
- });
351
- describe('Project Port operations', () => {
352
- beforeEach(() => {
353
- mockedFs.existsSync.mockReturnValue(false);
354
- });
355
- describe('getProjectPorts', () => {
356
- it('should get ports for a project', () => {
357
- const mockPorts = [
358
- {
359
- id: 1,
360
- project_id: 1,
361
- port: 3000,
362
- script_name: 'dev',
363
- config_source: 'package.json',
364
- last_detected: Date.now(),
365
- created_at: Date.now(),
366
- },
367
- ];
368
- mockedExecSync.mockReturnValue(JSON.stringify(mockPorts));
369
- const db = (0, database_1.getDatabaseManager)();
370
- const result = db.getProjectPorts(1);
371
- expect(result).toEqual(mockPorts);
372
- });
373
- });
374
- describe('getProjectPortsByScript', () => {
375
- it('should filter ports by script name', () => {
376
- const mockPorts = [
377
- {
378
- id: 1,
379
- project_id: 1,
380
- port: 3000,
381
- script_name: 'dev',
382
- config_source: 'package.json',
383
- last_detected: Date.now(),
384
- created_at: Date.now(),
385
- },
386
- {
387
- id: 2,
388
- project_id: 1,
389
- port: 3001,
390
- script_name: 'start',
391
- config_source: 'package.json',
392
- last_detected: Date.now(),
393
- created_at: Date.now(),
394
- },
395
- ];
396
- mockedExecSync.mockReturnValue(JSON.stringify(mockPorts));
397
- const db = (0, database_1.getDatabaseManager)();
398
- const result = db.getProjectPortsByScript(1, 'dev');
399
- expect(result.length).toBe(1);
400
- expect(result[0].script_name).toBe('dev');
401
- });
402
- });
403
- });
404
- describe('Settings operations', () => {
405
- beforeEach(() => {
406
- mockedFs.existsSync.mockReturnValue(false);
407
- });
408
- describe('getSetting', () => {
409
- it('should get a setting value', () => {
410
- const settings = {
411
- 'editor.type': 'vscode',
412
- 'browser.type': 'chrome',
413
- };
414
- mockedExecSync.mockReturnValue(JSON.stringify(settings));
415
- const db = (0, database_1.getDatabaseManager)();
416
- const result = db.getSetting('editor.type');
417
- expect(result).toBe('vscode');
418
- });
419
- it('should return null for non-existent setting', () => {
420
- mockedExecSync.mockReturnValue(JSON.stringify({}));
421
- const db = (0, database_1.getDatabaseManager)();
422
- const result = db.getSetting('nonexistent');
423
- expect(result).toBeNull();
424
- });
425
- });
426
- describe('setSetting', () => {
427
- it('should set a setting value', () => {
428
- mockedExecSync.mockReturnValue('');
429
- const db = (0, database_1.getDatabaseManager)();
430
- expect(() => db.setSetting('editor.type', 'cursor')).not.toThrow();
431
- expect(mockedExecSync).toHaveBeenCalledWith(expect.stringContaining('PUT'), expect.any(Object));
432
- });
433
- });
434
- describe('getAllSettings', () => {
435
- it('should get all settings', () => {
436
- const settings = {
437
- 'editor.type': 'vscode',
438
- 'browser.type': 'chrome',
439
- };
440
- mockedExecSync.mockReturnValue(JSON.stringify(settings));
441
- const db = (0, database_1.getDatabaseManager)();
442
- const result = db.getAllSettings();
443
- expect(result).toEqual(settings);
444
- });
445
- });
446
- });
447
- describe('Test Result operations', () => {
448
- beforeEach(() => {
449
- mockedFs.existsSync.mockReturnValue(false);
450
- });
451
- describe('addTestResult', () => {
452
- it('should add a test result', () => {
453
- const mockResult = {
454
- id: 1,
455
- project_id: 1,
456
- script_name: 'test',
457
- framework: 'jest',
458
- passed: 10,
459
- failed: 2,
460
- skipped: 1,
461
- total: 13,
462
- duration: 5000,
463
- coverage: 85.5,
464
- timestamp: Date.now(),
465
- raw_output: null,
466
- };
467
- mockedExecSync.mockReturnValue(JSON.stringify(mockResult));
468
- const db = (0, database_1.getDatabaseManager)();
469
- const result = db.addTestResult(1, 'test', 10, 2, 1, 13, 5000, 85.5, 'jest', null);
470
- expect(result).toEqual(mockResult);
471
- });
472
- it('should handle optional parameters', () => {
473
- const mockResult = {
474
- id: 1,
475
- project_id: 1,
476
- script_name: 'test',
477
- framework: null,
478
- passed: 5,
479
- failed: 0,
480
- skipped: 0,
481
- total: 5,
482
- duration: null,
483
- coverage: null,
484
- timestamp: Date.now(),
485
- raw_output: null,
486
- };
487
- mockedExecSync.mockReturnValue(JSON.stringify(mockResult));
488
- const db = (0, database_1.getDatabaseManager)();
489
- const result = db.addTestResult(1, 'test', 5, 0);
490
- expect(result.passed).toBe(5);
491
- expect(result.failed).toBe(0);
492
- });
493
- });
494
- describe('getLatestTestResult', () => {
495
- it('should get latest test result', () => {
496
- const mockResult = {
497
- id: 1,
498
- project_id: 1,
499
- script_name: 'test',
500
- framework: 'jest',
501
- passed: 10,
502
- failed: 0,
503
- skipped: 0,
504
- total: 10,
505
- duration: 3000,
506
- coverage: 90,
507
- timestamp: Date.now(),
508
- raw_output: null,
509
- };
510
- mockedExecSync.mockReturnValue(JSON.stringify(mockResult));
511
- const db = (0, database_1.getDatabaseManager)();
512
- const result = db.getLatestTestResult(1);
513
- expect(result).toEqual(mockResult);
514
- });
515
- it('should return null if no results found', () => {
516
- mockedExecSync.mockImplementation(() => {
517
- throw new Error('Not found');
518
- });
519
- const db = (0, database_1.getDatabaseManager)();
520
- const result = db.getLatestTestResult(1);
521
- expect(result).toBeNull();
522
- });
523
- });
524
- describe('getTestResultsByProject', () => {
525
- it('should get test results with default limit', () => {
526
- const mockResults = [];
527
- mockedExecSync.mockReturnValue(JSON.stringify(mockResults));
528
- const db = (0, database_1.getDatabaseManager)();
529
- const result = db.getTestResultsByProject(1);
530
- expect(mockedExecSync).toHaveBeenCalledWith(expect.stringContaining('limit=10'), expect.any(Object));
531
- expect(result).toEqual(mockResults);
532
- });
533
- it('should get test results with custom limit', () => {
534
- const mockResults = [];
535
- mockedExecSync.mockReturnValue(JSON.stringify(mockResults));
536
- const db = (0, database_1.getDatabaseManager)();
537
- db.getTestResultsByProject(1, 20);
538
- expect(mockedExecSync).toHaveBeenCalledWith(expect.stringContaining('limit=20'), expect.any(Object));
539
- });
540
- });
541
- });
542
- describe('getDatabaseManager singleton', () => {
543
- it('should return the same instance on multiple calls', () => {
544
- mockedFs.existsSync.mockReturnValue(false);
545
- const db1 = (0, database_1.getDatabaseManager)();
546
- const db2 = (0, database_1.getDatabaseManager)();
547
- expect(db1).toBe(db2);
548
- });
549
- });
550
- describe('close', () => {
551
- it('should be a no-op', () => {
552
- mockedFs.existsSync.mockReturnValue(false);
553
- const db = (0, database_1.getDatabaseManager)();
554
- expect(() => db.close()).not.toThrow();
555
- });
556
- });
557
- });
@@ -1 +0,0 @@
1
- export {};