You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
783 B
29 lines
783 B
const { system, filesystem } = require('gluegun')
|
|
|
|
const src = filesystem.path(__dirname, '..')
|
|
|
|
const cli = async cmd =>
|
|
system.run('node ' + filesystem.path(src, 'bin', 'nbx') + ` ${cmd}`)
|
|
|
|
test('outputs version', async () => {
|
|
const output = await cli('--version')
|
|
expect(output).toContain('0.0.1')
|
|
})
|
|
|
|
test('outputs help', async () => {
|
|
const output = await cli('--help')
|
|
expect(output).toContain('0.0.1')
|
|
})
|
|
|
|
test('generates file', async () => {
|
|
const output = await cli('generate foo')
|
|
|
|
expect(output).toContain('Generated file at models/foo-model.ts')
|
|
const foomodel = filesystem.read('models/foo-model.ts')
|
|
|
|
expect(foomodel).toContain(`module.exports = {`)
|
|
expect(foomodel).toContain(`name: 'foo'`)
|
|
|
|
// cleanup artifact
|
|
filesystem.remove('models')
|
|
})
|