| 69 | } |
| 70 | |
| 71 | function setBasicSpies() { |
| 72 | vi.spyOn(commandLine, 'listTemplateChoices').mockImplementation(async () => []) |
| 73 | vi |
| 74 | .spyOn(commandLine, 'resolveStarterSpecifier') |
| 75 | .mockImplementation(async (value) => |
| 76 | value === 'blog' |
| 77 | ? 'https://example.com/react/blog/starter.json' |
| 78 | : value, |
| 79 | ) |
| 80 | vi.spyOn(create, 'loadStarter').mockImplementation( |
| 81 | async (id) => |
| 82 | ({ |
| 83 | id: String(id), |
| 84 | name: 'Blog', |
| 85 | description: 'Blog template', |
| 86 | type: 'starter', |
| 87 | framework: 'react', |
| 88 | mode: 'file-router', |
| 89 | typescript: true, |
| 90 | dependsOn: [], |
| 91 | files: {}, |
| 92 | deletedFiles: [], |
| 93 | }) as any, |
| 94 | ) |
| 95 | vi.spyOn(prompts, 'getProjectName').mockImplementation(async () => 'hello') |
| 96 | vi.spyOn(prompts, 'selectTemplate').mockImplementation(async () => undefined) |
| 97 | vi.spyOn(prompts, 'selectPackageManager').mockImplementation( |
| 98 | async () => 'npm', |
| 99 | ) |
| 100 | vi.spyOn(prompts, 'selectToolchain').mockImplementation(async () => undefined) |
| 101 | vi.spyOn(prompts, 'selectAddOns').mockImplementation(async () => []) |
| 102 | } |
| 103 | |
| 104 | describe('promptForCreateOptions', () => { |
| 105 | //// Project name |