projax 3.3.58 → 3.3.59

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 (80) hide show
  1. package/dist/electron/script-runner.js +52 -20
  2. package/dist/index.js +1 -1
  3. package/dist/prxi.js +844 -109
  4. package/dist/prxi.tsx +1234 -179
  5. package/dist/script-runner.js +52 -20
  6. package/package.json +1 -1
  7. package/coverage/base.css +0 -224
  8. package/coverage/block-navigation.js +0 -87
  9. package/coverage/core-bridge.ts.html +0 -292
  10. package/coverage/favicon.png +0 -0
  11. package/coverage/index.html +0 -191
  12. package/coverage/lcov-report/base.css +0 -224
  13. package/coverage/lcov-report/block-navigation.js +0 -87
  14. package/coverage/lcov-report/core-bridge.ts.html +0 -292
  15. package/coverage/lcov-report/favicon.png +0 -0
  16. package/coverage/lcov-report/index.html +0 -191
  17. package/coverage/lcov-report/port-extractor.ts.html +0 -1174
  18. package/coverage/lcov-report/port-scanner.ts.html +0 -301
  19. package/coverage/lcov-report/port-utils.ts.html +0 -670
  20. package/coverage/lcov-report/prettify.css +0 -1
  21. package/coverage/lcov-report/prettify.js +0 -2
  22. package/coverage/lcov-report/script-runner.ts.html +0 -3346
  23. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  24. package/coverage/lcov-report/sorter.js +0 -210
  25. package/coverage/lcov-report/test-parser.ts.html +0 -799
  26. package/coverage/lcov.info +0 -1338
  27. package/coverage/port-extractor.ts.html +0 -1174
  28. package/coverage/port-scanner.ts.html +0 -301
  29. package/coverage/port-utils.ts.html +0 -670
  30. package/coverage/prettify.css +0 -1
  31. package/coverage/prettify.js +0 -2
  32. package/coverage/script-runner.ts.html +0 -3346
  33. package/coverage/sort-arrow-sprite.png +0 -0
  34. package/coverage/sorter.js +0 -210
  35. package/coverage/test-parser.ts.html +0 -799
  36. package/dist/__tests__/core-bridge.test.d.ts +0 -1
  37. package/dist/__tests__/core-bridge.test.js +0 -135
  38. package/dist/__tests__/port-extractor.test.d.ts +0 -1
  39. package/dist/__tests__/port-extractor.test.js +0 -407
  40. package/dist/__tests__/port-scanner.test.d.ts +0 -1
  41. package/dist/__tests__/port-scanner.test.js +0 -170
  42. package/dist/__tests__/port-utils.test.d.ts +0 -1
  43. package/dist/__tests__/port-utils.test.js +0 -127
  44. package/dist/__tests__/script-runner.test.d.ts +0 -1
  45. package/dist/__tests__/script-runner.test.js +0 -491
  46. package/dist/__tests__/test-parser.test.d.ts +0 -1
  47. package/dist/__tests__/test-parser.test.js +0 -276
  48. package/dist/api/__tests__/database.test.d.ts +0 -2
  49. package/dist/api/__tests__/database.test.d.ts.map +0 -1
  50. package/dist/api/__tests__/database.test.js +0 -485
  51. package/dist/api/__tests__/database.test.js.map +0 -1
  52. package/dist/api/__tests__/routes.test.d.ts +0 -2
  53. package/dist/api/__tests__/routes.test.d.ts.map +0 -1
  54. package/dist/api/__tests__/routes.test.js +0 -484
  55. package/dist/api/__tests__/routes.test.js.map +0 -1
  56. package/dist/api/__tests__/scanner.test.d.ts +0 -2
  57. package/dist/api/__tests__/scanner.test.d.ts.map +0 -1
  58. package/dist/api/__tests__/scanner.test.js +0 -403
  59. package/dist/api/__tests__/scanner.test.js.map +0 -1
  60. package/dist/core/__tests__/database.test.d.ts +0 -1
  61. package/dist/core/__tests__/database.test.js +0 -557
  62. package/dist/core/__tests__/detector.test.d.ts +0 -1
  63. package/dist/core/__tests__/detector.test.js +0 -375
  64. package/dist/core/__tests__/index.test.d.ts +0 -1
  65. package/dist/core/__tests__/index.test.js +0 -469
  66. package/dist/core/__tests__/scanner.test.d.ts +0 -1
  67. package/dist/core/__tests__/scanner.test.js +0 -406
  68. package/dist/core/__tests__/settings.test.d.ts +0 -1
  69. package/dist/core/__tests__/settings.test.js +0 -280
  70. package/dist/electron/core/__tests__/database.test.d.ts +0 -1
  71. package/dist/electron/core/__tests__/database.test.js +0 -557
  72. package/dist/electron/core/__tests__/detector.test.d.ts +0 -1
  73. package/dist/electron/core/__tests__/detector.test.js +0 -375
  74. package/dist/electron/core/__tests__/index.test.d.ts +0 -1
  75. package/dist/electron/core/__tests__/index.test.js +0 -469
  76. package/dist/electron/core/__tests__/scanner.test.d.ts +0 -1
  77. package/dist/electron/core/__tests__/scanner.test.js +0 -406
  78. package/dist/electron/core/__tests__/settings.test.d.ts +0 -1
  79. package/dist/electron/core/__tests__/settings.test.js +0 -280
  80. package/jest.config.js +0 -26
@@ -1,406 +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
- /* eslint-disable @typescript-eslint/no-var-requires */
37
- const fs = __importStar(require("fs"));
38
- const child_process_1 = require("child_process");
39
- const scanner_1 = require("../scanner");
40
- // Mock modules
41
- jest.mock('fs');
42
- jest.mock('child_process');
43
- const mockedFs = fs;
44
- const mockedExecSync = child_process_1.execSync;
45
- describe('scanner', () => {
46
- beforeEach(() => {
47
- jest.clearAllMocks();
48
- mockedFs.existsSync.mockReturnValue(false);
49
- // Reset the singleton
50
- require('../database').dbManager = null;
51
- });
52
- describe('scanProject', () => {
53
- it('should scan a project and return results', () => {
54
- const mockScanResponse = {
55
- project: {
56
- id: 1,
57
- name: 'Test Project',
58
- path: '/test/path',
59
- description: null,
60
- framework: 'jest',
61
- last_scanned: Date.now(),
62
- created_at: Date.now() - 10000,
63
- },
64
- testsFound: 3,
65
- tests: [
66
- {
67
- id: 1,
68
- project_id: 1,
69
- file_path: '/test/path/src/__tests__/file1.test.ts',
70
- framework: 'jest',
71
- status: null,
72
- last_run: null,
73
- created_at: Date.now(),
74
- },
75
- {
76
- id: 2,
77
- project_id: 1,
78
- file_path: '/test/path/src/__tests__/file2.test.ts',
79
- framework: 'jest',
80
- status: null,
81
- last_run: null,
82
- created_at: Date.now(),
83
- },
84
- {
85
- id: 3,
86
- project_id: 1,
87
- file_path: '/test/path/src/utils/helper.spec.ts',
88
- framework: 'jest',
89
- status: null,
90
- last_run: null,
91
- created_at: Date.now(),
92
- },
93
- ],
94
- };
95
- mockedExecSync.mockReturnValue(JSON.stringify(mockScanResponse));
96
- const result = (0, scanner_1.scanProject)(1);
97
- expect(result.project.id).toBe(1);
98
- expect(result.testsFound).toBe(3);
99
- expect(result.tests.length).toBe(3);
100
- expect(result.project.framework).toBe('jest');
101
- });
102
- it('should handle project with no tests found', () => {
103
- const mockScanResponse = {
104
- project: {
105
- id: 1,
106
- name: 'Empty Project',
107
- path: '/test/empty',
108
- description: null,
109
- framework: null,
110
- last_scanned: Date.now(),
111
- created_at: Date.now(),
112
- },
113
- testsFound: 0,
114
- tests: [],
115
- };
116
- mockedExecSync.mockReturnValue(JSON.stringify(mockScanResponse));
117
- const result = (0, scanner_1.scanProject)(1);
118
- expect(result.testsFound).toBe(0);
119
- expect(result.tests).toEqual([]);
120
- });
121
- it('should update last_scanned timestamp', () => {
122
- const mockScanResponse = {
123
- project: {
124
- id: 1,
125
- name: 'Test Project',
126
- path: '/test/path',
127
- description: null,
128
- framework: 'vitest',
129
- last_scanned: Date.now(),
130
- created_at: Date.now() - 100000,
131
- },
132
- testsFound: 1,
133
- tests: [],
134
- };
135
- mockedExecSync.mockReturnValue(JSON.stringify(mockScanResponse));
136
- const result = (0, scanner_1.scanProject)(1);
137
- expect(result.project.last_scanned).not.toBeNull();
138
- expect(result.project.last_scanned).toBeGreaterThan(Date.now() - 1000);
139
- });
140
- it('should detect and set framework during scan', () => {
141
- const mockScanResponse = {
142
- project: {
143
- id: 1,
144
- name: 'Test Project',
145
- path: '/test/path',
146
- description: null,
147
- framework: 'mocha',
148
- last_scanned: Date.now(),
149
- created_at: Date.now(),
150
- },
151
- testsFound: 1,
152
- tests: [
153
- {
154
- id: 1,
155
- project_id: 1,
156
- file_path: '/test/path/test/file.spec.js',
157
- framework: 'mocha',
158
- status: null,
159
- last_run: null,
160
- created_at: Date.now(),
161
- },
162
- ],
163
- };
164
- mockedExecSync.mockReturnValue(JSON.stringify(mockScanResponse));
165
- const result = (0, scanner_1.scanProject)(1);
166
- expect(result.project.framework).toBe('mocha');
167
- expect(result.tests[0].framework).toBe('mocha');
168
- });
169
- it('should handle API errors', () => {
170
- mockedExecSync.mockImplementation(() => {
171
- throw new Error('API request failed');
172
- });
173
- expect(() => (0, scanner_1.scanProject)(1)).toThrow('API request failed');
174
- });
175
- it('should handle non-existent project', () => {
176
- mockedExecSync.mockImplementation(() => {
177
- const error = new Error('Command failed: curl');
178
- error.message = 'Command failed: curl ... 404';
179
- throw error;
180
- });
181
- expect(() => (0, scanner_1.scanProject)(999)).toThrow();
182
- });
183
- });
184
- describe('scanAllProjects', () => {
185
- it('should scan all projects and return results', () => {
186
- const mockScanResults = [
187
- {
188
- project: {
189
- id: 1,
190
- name: 'Project 1',
191
- path: '/path/1',
192
- description: null,
193
- framework: 'jest',
194
- last_scanned: Date.now(),
195
- created_at: Date.now(),
196
- },
197
- testsFound: 2,
198
- tests: [
199
- {
200
- id: 1,
201
- project_id: 1,
202
- file_path: '/path/1/test1.test.ts',
203
- framework: 'jest',
204
- status: null,
205
- last_run: null,
206
- created_at: Date.now(),
207
- },
208
- {
209
- id: 2,
210
- project_id: 1,
211
- file_path: '/path/1/test2.test.ts',
212
- framework: 'jest',
213
- status: null,
214
- last_run: null,
215
- created_at: Date.now(),
216
- },
217
- ],
218
- },
219
- {
220
- project: {
221
- id: 2,
222
- name: 'Project 2',
223
- path: '/path/2',
224
- description: null,
225
- framework: 'vitest',
226
- last_scanned: Date.now(),
227
- created_at: Date.now(),
228
- },
229
- testsFound: 1,
230
- tests: [
231
- {
232
- id: 3,
233
- project_id: 2,
234
- file_path: '/path/2/test.spec.ts',
235
- framework: 'vitest',
236
- status: null,
237
- last_run: null,
238
- created_at: Date.now(),
239
- },
240
- ],
241
- },
242
- ];
243
- mockedExecSync.mockReturnValue(JSON.stringify(mockScanResults));
244
- const results = (0, scanner_1.scanAllProjects)();
245
- expect(results.length).toBe(2);
246
- expect(results[0].project.name).toBe('Project 1');
247
- expect(results[0].testsFound).toBe(2);
248
- expect(results[1].project.name).toBe('Project 2');
249
- expect(results[1].testsFound).toBe(1);
250
- });
251
- it('should handle empty project list', () => {
252
- mockedExecSync.mockReturnValue(JSON.stringify([]));
253
- const results = (0, scanner_1.scanAllProjects)();
254
- expect(results).toEqual([]);
255
- });
256
- it('should handle projects with different test frameworks', () => {
257
- const mockScanResults = [
258
- {
259
- project: {
260
- id: 1,
261
- name: 'Jest Project',
262
- path: '/jest',
263
- description: null,
264
- framework: 'jest',
265
- last_scanned: Date.now(),
266
- created_at: Date.now(),
267
- },
268
- testsFound: 1,
269
- tests: [],
270
- },
271
- {
272
- project: {
273
- id: 2,
274
- name: 'Vitest Project',
275
- path: '/vitest',
276
- description: null,
277
- framework: 'vitest',
278
- last_scanned: Date.now(),
279
- created_at: Date.now(),
280
- },
281
- testsFound: 1,
282
- tests: [],
283
- },
284
- {
285
- project: {
286
- id: 3,
287
- name: 'Mocha Project',
288
- path: '/mocha',
289
- description: null,
290
- framework: 'mocha',
291
- last_scanned: Date.now(),
292
- created_at: Date.now(),
293
- },
294
- testsFound: 1,
295
- tests: [],
296
- },
297
- ];
298
- mockedExecSync.mockReturnValue(JSON.stringify(mockScanResults));
299
- const results = (0, scanner_1.scanAllProjects)();
300
- expect(results.length).toBe(3);
301
- expect(results[0].project.framework).toBe('jest');
302
- expect(results[1].project.framework).toBe('vitest');
303
- expect(results[2].project.framework).toBe('mocha');
304
- });
305
- it('should handle some projects with no tests', () => {
306
- const mockScanResults = [
307
- {
308
- project: {
309
- id: 1,
310
- name: 'Project with tests',
311
- path: '/path/1',
312
- description: null,
313
- framework: 'jest',
314
- last_scanned: Date.now(),
315
- created_at: Date.now(),
316
- },
317
- testsFound: 2,
318
- tests: [],
319
- },
320
- {
321
- project: {
322
- id: 2,
323
- name: 'Project without tests',
324
- path: '/path/2',
325
- description: null,
326
- framework: null,
327
- last_scanned: Date.now(),
328
- created_at: Date.now(),
329
- },
330
- testsFound: 0,
331
- tests: [],
332
- },
333
- ];
334
- mockedExecSync.mockReturnValue(JSON.stringify(mockScanResults));
335
- const results = (0, scanner_1.scanAllProjects)();
336
- expect(results.length).toBe(2);
337
- expect(results[0].testsFound).toBe(2);
338
- expect(results[1].testsFound).toBe(0);
339
- });
340
- it('should update all projects last_scanned timestamp', () => {
341
- const mockScanResults = [
342
- {
343
- project: {
344
- id: 1,
345
- name: 'Project 1',
346
- path: '/path/1',
347
- description: null,
348
- framework: null,
349
- last_scanned: Date.now(),
350
- created_at: Date.now() - 100000,
351
- },
352
- testsFound: 0,
353
- tests: [],
354
- },
355
- {
356
- project: {
357
- id: 2,
358
- name: 'Project 2',
359
- path: '/path/2',
360
- description: null,
361
- framework: null,
362
- last_scanned: Date.now(),
363
- created_at: Date.now() - 100000,
364
- },
365
- testsFound: 0,
366
- tests: [],
367
- },
368
- ];
369
- mockedExecSync.mockReturnValue(JSON.stringify(mockScanResults));
370
- const results = (0, scanner_1.scanAllProjects)();
371
- results.forEach(result => {
372
- expect(result.project.last_scanned).not.toBeNull();
373
- expect(result.project.last_scanned).toBeGreaterThan(Date.now() - 1000);
374
- });
375
- });
376
- it('should handle API errors', () => {
377
- mockedExecSync.mockImplementation(() => {
378
- throw new Error('API request failed');
379
- });
380
- expect(() => (0, scanner_1.scanAllProjects)()).toThrow('API request failed');
381
- });
382
- });
383
- describe('ScanResult type', () => {
384
- it('should have correct structure', () => {
385
- const scanResult = {
386
- project: {
387
- id: 1,
388
- name: 'Test',
389
- path: '/test',
390
- description: null,
391
- framework: null,
392
- last_scanned: null,
393
- created_at: Date.now(),
394
- },
395
- testsFound: 0,
396
- tests: [],
397
- };
398
- expect(scanResult).toHaveProperty('project');
399
- expect(scanResult).toHaveProperty('testsFound');
400
- expect(scanResult).toHaveProperty('tests');
401
- expect(scanResult.project).toHaveProperty('id');
402
- expect(scanResult.project).toHaveProperty('name');
403
- expect(scanResult.project).toHaveProperty('path');
404
- });
405
- });
406
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,280 +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
- /* eslint-disable @typescript-eslint/no-var-requires */
37
- const fs = __importStar(require("fs"));
38
- const child_process_1 = require("child_process");
39
- const settings_1 = require("../settings");
40
- // Mock modules
41
- jest.mock('fs');
42
- jest.mock('child_process');
43
- const mockedFs = fs;
44
- const mockedExecSync = child_process_1.execSync;
45
- describe('settings', () => {
46
- beforeEach(() => {
47
- jest.clearAllMocks();
48
- mockedFs.existsSync.mockReturnValue(false);
49
- // Reset the singleton
50
- require('../database').dbManager = null;
51
- });
52
- describe('getSetting', () => {
53
- it('should get a setting value', () => {
54
- const settings = {
55
- 'editor.type': 'vscode',
56
- 'browser.type': 'chrome',
57
- };
58
- mockedExecSync.mockReturnValue(JSON.stringify(settings));
59
- const result = (0, settings_1.getSetting)('editor.type');
60
- expect(result).toBe('vscode');
61
- });
62
- it('should return null for non-existent setting', () => {
63
- mockedExecSync.mockReturnValue(JSON.stringify({}));
64
- const result = (0, settings_1.getSetting)('nonexistent');
65
- expect(result).toBeNull();
66
- });
67
- });
68
- describe('setSetting', () => {
69
- it('should set a setting value', () => {
70
- mockedExecSync.mockReturnValue('');
71
- expect(() => (0, settings_1.setSetting)('editor.type', 'cursor')).not.toThrow();
72
- expect(mockedExecSync).toHaveBeenCalled();
73
- });
74
- });
75
- describe('getAllSettings', () => {
76
- it('should get all settings', () => {
77
- const settings = {
78
- 'editor.type': 'vscode',
79
- 'browser.type': 'chrome',
80
- 'editor.customPath': '/path/to/editor',
81
- };
82
- mockedExecSync.mockReturnValue(JSON.stringify(settings));
83
- const result = (0, settings_1.getAllSettings)();
84
- expect(result).toEqual(settings);
85
- expect(Object.keys(result).length).toBe(3);
86
- });
87
- it('should return empty object when no settings exist', () => {
88
- mockedExecSync.mockReturnValue(JSON.stringify({}));
89
- const result = (0, settings_1.getAllSettings)();
90
- expect(result).toEqual({});
91
- });
92
- });
93
- describe('getEditorSettings', () => {
94
- it('should get editor settings with default values', () => {
95
- mockedExecSync.mockReturnValue(JSON.stringify({}));
96
- const result = (0, settings_1.getEditorSettings)();
97
- expect(result.type).toBe('vscode');
98
- expect(result.customPath).toBeUndefined();
99
- });
100
- it('should get editor settings with custom values', () => {
101
- const settings = {
102
- 'editor.type': 'cursor',
103
- 'editor.customPath': '/path/to/cursor',
104
- };
105
- mockedExecSync.mockReturnValue(JSON.stringify(settings));
106
- const result = (0, settings_1.getEditorSettings)();
107
- expect(result.type).toBe('cursor');
108
- expect(result.customPath).toBe('/path/to/cursor');
109
- });
110
- it('should handle only type being set', () => {
111
- const settings = {
112
- 'editor.type': 'zed',
113
- };
114
- mockedExecSync.mockReturnValue(JSON.stringify(settings));
115
- const result = (0, settings_1.getEditorSettings)();
116
- expect(result.type).toBe('zed');
117
- expect(result.customPath).toBeUndefined();
118
- });
119
- it('should support all editor types', () => {
120
- const editorTypes = ['vscode', 'cursor', 'windsurf', 'zed', 'custom'];
121
- editorTypes.forEach(type => {
122
- const settings = { 'editor.type': type };
123
- mockedExecSync.mockReturnValue(JSON.stringify(settings));
124
- const result = (0, settings_1.getEditorSettings)();
125
- expect(result.type).toBe(type);
126
- });
127
- });
128
- });
129
- describe('setEditorSettings', () => {
130
- it('should set editor type', () => {
131
- mockedExecSync.mockReturnValue('');
132
- const settings = { type: 'cursor' };
133
- expect(() => (0, settings_1.setEditorSettings)(settings)).not.toThrow();
134
- expect(mockedExecSync).toHaveBeenCalled();
135
- });
136
- it('should set editor type and custom path', () => {
137
- mockedExecSync.mockReturnValue('');
138
- const settings = {
139
- type: 'custom',
140
- customPath: '/usr/local/bin/myeditor',
141
- };
142
- expect(() => (0, settings_1.setEditorSettings)(settings)).not.toThrow();
143
- expect(mockedExecSync).toHaveBeenCalledTimes(2);
144
- });
145
- it('should handle setting without custom path', () => {
146
- mockedExecSync.mockReturnValue('');
147
- const settings = { type: 'vscode' };
148
- expect(() => (0, settings_1.setEditorSettings)(settings)).not.toThrow();
149
- expect(mockedExecSync).toHaveBeenCalledTimes(1);
150
- });
151
- });
152
- describe('getBrowserSettings', () => {
153
- it('should get browser settings with default values', () => {
154
- mockedExecSync.mockReturnValue(JSON.stringify({}));
155
- const result = (0, settings_1.getBrowserSettings)();
156
- expect(result.type).toBe('chrome');
157
- expect(result.customPath).toBeUndefined();
158
- });
159
- it('should get browser settings with custom values', () => {
160
- const settings = {
161
- 'browser.type': 'firefox',
162
- 'browser.customPath': '/path/to/firefox',
163
- };
164
- mockedExecSync.mockReturnValue(JSON.stringify(settings));
165
- const result = (0, settings_1.getBrowserSettings)();
166
- expect(result.type).toBe('firefox');
167
- expect(result.customPath).toBe('/path/to/firefox');
168
- });
169
- it('should support all browser types', () => {
170
- const browserTypes = ['chrome', 'firefox', 'safari', 'edge', 'custom'];
171
- browserTypes.forEach(type => {
172
- const settings = { 'browser.type': type };
173
- mockedExecSync.mockReturnValue(JSON.stringify(settings));
174
- const result = (0, settings_1.getBrowserSettings)();
175
- expect(result.type).toBe(type);
176
- });
177
- });
178
- });
179
- describe('setBrowserSettings', () => {
180
- it('should set browser type', () => {
181
- mockedExecSync.mockReturnValue('');
182
- const settings = { type: 'firefox' };
183
- expect(() => (0, settings_1.setBrowserSettings)(settings)).not.toThrow();
184
- expect(mockedExecSync).toHaveBeenCalled();
185
- });
186
- it('should set browser type and custom path', () => {
187
- mockedExecSync.mockReturnValue('');
188
- const settings = {
189
- type: 'custom',
190
- customPath: '/usr/local/bin/mybrowser',
191
- };
192
- expect(() => (0, settings_1.setBrowserSettings)(settings)).not.toThrow();
193
- expect(mockedExecSync).toHaveBeenCalledTimes(2);
194
- });
195
- });
196
- describe('getAppSettings', () => {
197
- it('should get all app settings with defaults', () => {
198
- mockedExecSync.mockReturnValue(JSON.stringify({}));
199
- const result = (0, settings_1.getAppSettings)();
200
- expect(result.editor.type).toBe('vscode');
201
- expect(result.browser.type).toBe('chrome');
202
- });
203
- it('should get all app settings with custom values', () => {
204
- const settings = {
205
- 'editor.type': 'cursor',
206
- 'editor.customPath': '/path/to/cursor',
207
- 'browser.type': 'firefox',
208
- 'browser.customPath': '/path/to/firefox',
209
- };
210
- mockedExecSync.mockReturnValue(JSON.stringify(settings));
211
- const result = (0, settings_1.getAppSettings)();
212
- expect(result.editor.type).toBe('cursor');
213
- expect(result.editor.customPath).toBe('/path/to/cursor');
214
- expect(result.browser.type).toBe('firefox');
215
- expect(result.browser.customPath).toBe('/path/to/firefox');
216
- });
217
- it('should return complete app settings structure', () => {
218
- mockedExecSync.mockReturnValue(JSON.stringify({}));
219
- const result = (0, settings_1.getAppSettings)();
220
- expect(result).toHaveProperty('editor');
221
- expect(result).toHaveProperty('browser');
222
- expect(result.editor).toHaveProperty('type');
223
- expect(result.browser).toHaveProperty('type');
224
- });
225
- });
226
- describe('setAppSettings', () => {
227
- it('should set both editor and browser settings', () => {
228
- mockedExecSync.mockReturnValue('');
229
- const settings = {
230
- editor: { type: 'cursor' },
231
- browser: { type: 'firefox' },
232
- };
233
- expect(() => (0, settings_1.setAppSettings)(settings)).not.toThrow();
234
- expect(mockedExecSync).toHaveBeenCalledTimes(2);
235
- });
236
- it('should set all settings including custom paths', () => {
237
- mockedExecSync.mockReturnValue('');
238
- const settings = {
239
- editor: {
240
- type: 'custom',
241
- customPath: '/path/to/editor',
242
- },
243
- browser: {
244
- type: 'custom',
245
- customPath: '/path/to/browser',
246
- },
247
- };
248
- expect(() => (0, settings_1.setAppSettings)(settings)).not.toThrow();
249
- expect(mockedExecSync).toHaveBeenCalledTimes(4);
250
- });
251
- });
252
- describe('type definitions', () => {
253
- it('should allow valid editor types', () => {
254
- const validTypes = [
255
- 'vscode',
256
- 'cursor',
257
- 'windsurf',
258
- 'zed',
259
- 'custom',
260
- ];
261
- validTypes.forEach(type => {
262
- const settings = { type };
263
- expect(settings.type).toBe(type);
264
- });
265
- });
266
- it('should allow valid browser types', () => {
267
- const validTypes = [
268
- 'chrome',
269
- 'firefox',
270
- 'safari',
271
- 'edge',
272
- 'custom',
273
- ];
274
- validTypes.forEach(type => {
275
- const settings = { type };
276
- expect(settings.type).toBe(type);
277
- });
278
- });
279
- });
280
- });
@@ -1 +0,0 @@
1
- export {};