Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
group.before(async () => {
await registrar.providers([
path.join(__dirname, '../providers/SwaggerProvider')
]).register()
// call in boot SwaggerProvider
ace.addCommand('Adonis/Commands/SwaggerExport')
ace.addCommand('Adonis/Commands/SwaggerExportDocs')
ace.addCommand('Adonis/Commands/SwaggerRemove')
ace.addCommand('Adonis/Commands/SwaggerRemoveDocs')
})
test('log queries when asked to log', async (assert) => {
ace.addCommand(MigrationRun)
ace.addCommand(MigrationRollback)
await fs.writeFile(path.join(__dirname, 'database/migrations/User.js'), `
const Schema = use('Schema')
class User extends Schema {
up () {
this.createTable('schema_users', (table) => {
table.increments()
table.string('username')
})
}
down () {
this.drop('schema_users')
}
}
it('import models', async () => {
ace.addCommand(Import)
jest.spyOn(console, 'log')
const TestModel = require('../unit/fixtures/TestModel')
TestModel._bootIfNotBooted()
ioc.bind('App/Models/TestModel', () => TestModel)
await ioc.use('Database').table('posts').insert([
{ title: 'foo' },
{ title: 'bar' },
{ title: 'foobar' }
])
await ace.call('scout:import', { model: 'TestModel' })
_addCommands () {
const ace = require('@adonisjs/ace')
ace.addCommand('Adonis/Commands/SwaggerExport')
ace.addCommand('Adonis/Commands/SwaggerExportDocs')
ace.addCommand('Adonis/Commands/SwaggerRemove')
ace.addCommand('Adonis/Commands/SwaggerRemoveDocs')
}
boot () {
const ace = require('@adonisjs/ace')
ace.addCommand('Adonis/Commands/Run:Scheduler')
ace.addCommand('Adonis/Commands/Make:Task')
}
}
boot () {
const ace = require('@adonisjs/ace')
ace.addCommand('Adonis/Commands/Migration:Run')
ace.addCommand('Adonis/Commands/Migration:Rollback')
ace.addCommand('Adonis/Commands/Migration:Refresh')
ace.addCommand('Adonis/Commands/Migration:Reset')
ace.addCommand('Adonis/Commands/Migration:Status')
ace.addCommand('Adonis/Commands/Seed')
}
}
boot () {
const ace = require('@adonisjs/ace')
ace.addCommand('Adonis/Commands/Make:Job')
}
}
boot () {
const ace = require('@adonisjs/ace')
ace.addCommand('Adonis/Commands/Schema:Build')
}
}
boot () {
const ace = require('@adonisjs/ace')
ace.addCommand('Adonis/Commands/Scout:IndexUp')
ace.addCommand('Adonis/Commands/Scout:IndexDown')
ace.addCommand('Adonis/Commands/Scout:Import')
ace.addCommand('Adonis/Commands/Scout:Flush')
}
}
_.forEach(Commands, Command => Ace.addCommand(Command))
}