|
1 | | -import {describe, it, expect} from 'vitest'; |
| 1 | +import {scaffoldChoice} from '@form8ion/javascript-core'; |
2 | 2 |
|
| 3 | +import {describe, it, expect, vi} from 'vitest'; |
| 4 | +import {when} from 'vitest-when'; |
| 5 | +import any from '@travi/any'; |
| 6 | + |
| 7 | +import prompt from './prompt.js'; |
3 | 8 | import scaffoldIntegrationTesting from './scaffolder.js'; |
4 | 9 |
|
| 10 | +vi.mock('@form8ion/javascript-core'); |
| 11 | +vi.mock('./prompt.js'); |
| 12 | + |
5 | 13 | describe('integration testing scaffolder', () => { |
6 | 14 | it('should scaffold the chosen framework', async () => { |
7 | | - expect(scaffoldIntegrationTesting()).toEqual({}); |
| 15 | + const projectRoot = any.string(); |
| 16 | + const decisions = any.simpleObject(); |
| 17 | + const dialect = any.word(); |
| 18 | + const chosenFramework = any.word(); |
| 19 | + const integrationTestFrameworks = any.simpleObject(); |
| 20 | + const integrationTestFrameworkResults = any.simpleObject(); |
| 21 | + when(prompt).calledWith({frameworks: integrationTestFrameworks, decisions}).thenResolve(chosenFramework); |
| 22 | + when(scaffoldChoice) |
| 23 | + .calledWith(integrationTestFrameworks, chosenFramework, {projectRoot, dialect}) |
| 24 | + .thenResolve(integrationTestFrameworkResults); |
| 25 | + |
| 26 | + expect(await scaffoldIntegrationTesting({projectRoot, frameworks: integrationTestFrameworks, decisions, dialect})) |
| 27 | + .toEqual(integrationTestFrameworkResults); |
8 | 28 | }); |
9 | 29 | }); |
0 commit comments