How to use the @adonisjs/ace.call function in @adonisjs/ace

To help you get started, we’ve selected a few @adonisjs/ace examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nrempel / adonis-kue / test / functional / commands.spec.js View on Github external
test('Create a job with the same name', async assert => {
    await ace.call('make:job', { name: 'Test' })
    const filePath = path.join(__dirname, '../../app/Jobs/Test.js')
    assert.isTrue(fs.existsSync(filePath))
    fs.unlinkSync(filePath)
  })
})
github HigoRibeiro / adonis-gql / test / functional / command.spec.js View on Github external
test('create a schema file', async assert => {
    await ace.call('gql:schema', { name: 'Post' })

    const schema = fs.readFileSync('app/Schemas/Post.graphql', 'utf-8')
    assert.equal(schema, getSchemaContent())
  })
github nrempel / adonis-kue / test / functional / commands.spec.js View on Github external
test('kue:listen', async assert => {
    const Kue = use('Adonis/Addons/Kue')
    const Job = ioc.use('App/GoodJob')
    await ace.call('kue:listen')
    const data = { test: 'data' }
    const job = Kue.dispatch(Job.key, data)
    const result = await job.result
    assert.equal(result, 'test result')
    assert.equal(job.type, Job.key)
    assert.equal(job.data, data)
  })
github HigoRibeiro / adonis-gql / test / functional / command.spec.js View on Github external
test('create a directive file', async assert => {
    await ace.call('gql:directive', { name: 'Deprecated' })

    const directive = fs.readFileSync(
      'app/Directives/DeprecatedDirective.js',
      'utf-8'
    )

    assert.equal(directive, getDirectiveContent())
  })
github duyluonglc / lucid-mongo / test / functional / migration-rollback.spec.js View on Github external
test('skip when there is nothing to rollback', async (assert) => {
    ace.addCommand(MigrationRollback)
    const result = await ace.call('migration:rollback')
    assert.deepEqual(result, { migrated: [], status: 'skipped', queries: undefined })
  })
github enniel / adonis-acl / test / functional / commands.spec.js View on Github external
test('acl:role', async (assert) => {
    await ace.call('acl:role', {
      slug: 'administrator',
      name: 'Administrator',
      description: 'Administrator Role Description'
    }, {
      permissions: 'create_users,edit_users,delete_users'
    })
    const Role = use('Adonis/Acl/Role')
    const role = await Role.findBy('name', 'Administrator')
    const permissions = await role.getPermissions()
    assert.equal(role.slug, 'administrator')
    assert.equal(role.name, 'Administrator')
    assert.equal(role.description, 'Administrator Role Description')
    assert.includeMembers(permissions, [
      'create_users', 'edit_users', 'delete_users'
    ])
  })
github brainnit / adonisjs-scout / test / functional / index-up.spec.js View on Github external
})
        }
      }
      module.exports = IndexKeeper
    `)

    await fs.outputFile(path.join(__dirname, 'app/Models/IndexKeepers/bar.js'), `
      class IndexKeeper {
        up () {
          (global).stack.push('bar')
        }
      }
      module.exports = IndexKeeper
    `)

    await ace.call('scout:up', {}, { files: 'foo.js' })
    expect(global.stack).toContainEqual('foo')
  })
})
github adonisjs / adonis-lucid / test / functional / migration-rollback.spec.js View on Github external
up () {
          this.createTable('schema_users', (table) => {
            table.increments()
            table.string('username')
          })
        }

        down () {
          this.drop('schema_users')
        }
      }

      module.exports = User
    `)

    await ace.call('migration:run')
    const result = await ace.call('migration:rollback', {}, { log: true })
    assert.isArray(result.queries)
  })
})
github duyluonglc / lucid-mongo / test / functional / migration-run.spec.js View on Github external
ace.addCommand(MigrationRun)
    await fs.writeFile(path.join(__dirname, 'database/migrations/User.js'), `
      const Schema = use('Schema')
      class User extends Schema {
        up () {
          this.createCollection('schema_users', (collection) => {
            collection.increments()
            collection.string('username')
          })
        }
      }

      module.exports = User
    `)

    const result = await ace.call('migration:run')
    assert.deepEqual(result, { migrated: ['User'], status: 'completed', queries: undefined })
    const migrations = await ioc.use('Database').collection('adonis_schema').find()
    assert.lengthOf(migrations, 1)
    assert.equal(migrations[0].batch, 1)
    assert.equal(migrations[0].name, 'User')
  })
github adonisjs / adonis-lucid / commands / MigrationRefresh.js View on Github external
async handle (args, { log, force, silent, seed, keepAlive }) {
    this._validateState(force)

    if (keepAlive) {
      this.migration.keepAlive()
    }

    await ace.call('migration:reset', {}, { log, force, silent })
    await ace.call('migration:run', {}, { log, force, silent, seed, keepAlive })
  }
}