Created
May 18, 2022 18:18
-
-
Save YonatanKra/dcdca872ddd62ef04898ba68f89a3d45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {names, Tree} from '@nrwl/devkit'; | |
import {createTreeWithEmptyWorkspace} from '@nrwl/devkit/testing'; | |
import {VividComponentGeneratorOptions} from './schema'; | |
import vividComponentGenerator from './index'; | |
describe(`vivid component generator`, function () { | |
let tree: Tree; | |
const options: VividComponentGeneratorOptions = { | |
name: 'test-component' | |
}; | |
beforeEach(() => { | |
tree = createTreeWithEmptyWorkspace(); | |
}); | |
it(`should generate files`, async function () { | |
const {fileName} = names(options.name); | |
await vividComponentGenerator(tree, options); | |
expect(tree.exists(`libs/components/src/lib/${options.name}`)) | |
.toBeTruthy(); | |
expect(tree.exists(`libs/components/src/lib/${options.name}/index.ts`)) | |
.toBeTruthy(); | |
expect(tree.exists(`libs/components/src/lib/${options.name}/README.md`)) | |
.toBeTruthy(); | |
expect(tree.exists(`libs/components/src/lib/${options.name}/ui.test.ts`)) | |
.toBeTruthy(); | |
expect(tree.exists(`libs/components/src/lib/${options.name}/${fileName}.ts`)) | |
.toBeTruthy(); | |
expect(tree.exists(`libs/components/src/lib/${options.name}/${fileName}.spec.ts`)) | |
.toBeTruthy(); | |
expect(tree.exists(`libs/components/src/lib/${options.name}/${fileName}.template.ts`)) | |
.toBeTruthy(); | |
expect(tree.exists(`libs/components/src/lib/${options.name}/${fileName}.scss`)) | |
.toBeTruthy(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment