Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
Created May 18, 2022 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YonatanKra/dcdca872ddd62ef04898ba68f89a3d45 to your computer and use it in GitHub Desktop.
Save YonatanKra/dcdca872ddd62ef04898ba68f89a3d45 to your computer and use it in GitHub Desktop.
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