|
| 1 | +import { |
| 2 | + checkFilesExist, |
| 3 | + ensureNxProject, |
| 4 | + readJson, |
| 5 | + runNxCommandAsync, |
| 6 | + uniq, |
| 7 | +} from '@nrwl/nx-plugin/testing'; |
| 8 | +describe('ddd e2e', () => { |
| 9 | + it('should create ddd', async () => { |
| 10 | + const plugin = uniq('ddd'); |
| 11 | + ensureNxProject('@angular-architects/ddd', 'dist/packages/ddd'); |
| 12 | + await runNxCommandAsync(`generate @angular-architects/ddd:ddd ${plugin}`); |
| 13 | + |
| 14 | + const result = await runNxCommandAsync(`build ${plugin}`); |
| 15 | + expect(result.stdout).toContain('Executor ran'); |
| 16 | + }, 120000); |
| 17 | + |
| 18 | + describe('--directory', () => { |
| 19 | + it('should create src in the specified directory', async () => { |
| 20 | + const plugin = uniq('ddd'); |
| 21 | + ensureNxProject('@angular-architects/ddd', 'dist/packages/ddd'); |
| 22 | + await runNxCommandAsync( |
| 23 | + `generate @angular-architects/ddd:ddd ${plugin} --directory subdir` |
| 24 | + ); |
| 25 | + expect(() => |
| 26 | + checkFilesExist(`libs/subdir/${plugin}/src/index.ts`) |
| 27 | + ).not.toThrow(); |
| 28 | + }, 120000); |
| 29 | + }); |
| 30 | + |
| 31 | + describe('--tags', () => { |
| 32 | + it('should add tags to the project', async () => { |
| 33 | + const plugin = uniq('ddd'); |
| 34 | + ensureNxProject('@angular-architects/ddd', 'dist/packages/ddd'); |
| 35 | + await runNxCommandAsync( |
| 36 | + `generate @angular-architects/ddd:ddd ${plugin} --tags e2etag,e2ePackage` |
| 37 | + ); |
| 38 | + const project = readJson(`libs/${plugin}/project.json`); |
| 39 | + expect(project.tags).toEqual(['e2etag', 'e2ePackage']); |
| 40 | + }, 120000); |
| 41 | + }); |
| 42 | +}); |
0 commit comments