Skip to content

Commit

Permalink
feat(cli): update tests in task generator (#2128)
Browse files Browse the repository at this point in the history
  • Loading branch information
splitinfinities authored and adamdbradley committed Jan 13, 2020
1 parent c63a64f commit e6af190
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/cli_next/tasks/task-generate.ts
Expand Up @@ -146,11 +146,22 @@ const getStyleUrlBoilerplate = () =>
* Get the boilerplate for a spec test.
*/
const getSpecTestBoilerplate = (tagName: string) =>
`import { ${toPascalCase(tagName)} } from './${tagName}';
`import { newSpecPage } from '@stencil/core/testing';
import { ${toPascalCase(tagName)} } from './${tagName}';
describe('${tagName}', () => {
it('builds', () => {
expect(new ${toPascalCase(tagName)}()).toBeTruthy();
it('renders', async () => {
const page = await newSpecPage({
components: [${toPascalCase(tagName)}],
html: \`<${tagName}></${tagName}>\`,
});
expect(page.root).toEqualHtml(\`
<${tagName}>
<mock:shadow-root>
<slot></slot>
</mock:shadow-root>
</${tagName}>
\`);
});
});
`;
Expand Down

0 comments on commit e6af190

Please sign in to comment.