Skip to content

Commit

Permalink
Add unit test for generator to keep 100% coverage (apache#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw committed Feb 4, 2019
1 parent cebf104 commit 5639f3d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/generator-superset/generators/package/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = class extends Generator {
type: 'list',
name: 'language',
message: 'Choose language',
default: 'typescript',
choices: [
{
name: 'typescript',
Expand Down
2 changes: 1 addition & 1 deletion packages/generator-superset/test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('generator-superset:app', () => {
});

it('creates files', () => {
assert.file(['package.json', 'README.md', 'src/index.js', 'test/index.test.js']);
assert.file(['package.json', 'README.md', 'src/index.ts', 'test/index.test.ts']);
});

/*
Expand Down
29 changes: 23 additions & 6 deletions packages/generator-superset/test/package.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,32 @@ describe('generator-superset:package', () => {

beforeAll(() => {
dir = process.cwd();
});

describe('typescript', () => {
beforeAll(() =>
helpers
.run(path.join(__dirname, '../generators/package'))
.withPrompts({ name: 'my-package', language: 'typescript' })
.withOptions({ skipInstall: true }),
);

return helpers
.run(path.join(__dirname, '../generators/package'))
.withPrompts({ name: 'my-package' })
.withOptions({ skipInstall: true });
it('creates files', () => {
assert.file(['package.json', 'README.md', 'src/index.ts', 'test/index.test.ts']);
});
});

it('creates files', () => {
assert.file(['package.json', 'README.md', 'src/index.js', 'test/index.test.js']);
describe('javascript', () => {
beforeAll(() =>
helpers
.run(path.join(__dirname, '../generators/package'))
.withPrompts({ name: 'my-package', language: 'javascript' })
.withOptions({ skipInstall: true }),
);

it('creates files', () => {
assert.file(['package.json', 'README.md', 'src/index.js', 'test/index.test.js']);
});
});

/*
Expand Down

0 comments on commit 5639f3d

Please sign in to comment.