|
1 | | -import { afterEach, beforeEach, describe, expect, test } from 'bun:test'; |
| 1 | +import { afterEach, beforeEach, describe, expect, spyOn, test } from 'bun:test'; |
2 | 2 | import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises'; |
3 | 3 | import { tmpdir } from 'node:os'; |
4 | 4 | import { join } from 'node:path'; |
5 | 5 | import { pluginSearch } from '../../src/commands/plugin-search'; |
| 6 | +import * as claudeCodeConfig from '../../src/helpers/claude-code-config'; |
| 7 | +import { defaultIO } from '../../src/helpers/io'; |
6 | 8 |
|
7 | 9 | describe('plugin-search', () => { |
8 | 10 | let testDir: string; |
@@ -277,12 +279,23 @@ describe('plugin-search', () => { |
277 | 279 | }); |
278 | 280 |
|
279 | 281 | describe('error handling', () => { |
280 | | - test('should error if no plugins.json found', async () => { |
| 282 | + test('should log info if no marketplaces configured', async () => { |
281 | 283 | const options = { |
282 | 284 | cwd: testDir, |
283 | 285 | }; |
284 | 286 |
|
285 | | - await expect(pluginSearch(options)).rejects.toThrow('No plugins.json found'); |
| 287 | + // Mock Claude Code as not installed to ensure no auto-discovered marketplaces |
| 288 | + const claudeSpy = spyOn(claudeCodeConfig, 'isClaudeCodeInstalled').mockResolvedValue(false); |
| 289 | + const infoSpy = spyOn(defaultIO, 'logInfo'); |
| 290 | + |
| 291 | + await pluginSearch(options); |
| 292 | + |
| 293 | + expect(infoSpy).toHaveBeenCalledWith( |
| 294 | + 'No marketplaces configured. Add a marketplace first with: aipm marketplace add <name> <path>', |
| 295 | + ); |
| 296 | + |
| 297 | + claudeSpy.mockRestore(); |
| 298 | + infoSpy.mockRestore(); |
286 | 299 | }); |
287 | 300 |
|
288 | 301 | test('should handle marketplaces with invalid paths', async () => { |
|
0 commit comments