How to use the @adonisjs/fold.ioc.alias function in @adonisjs/fold

To help you get started, we’ve selected a few @adonisjs/fold 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
port: 6379,
          db: 0,
          keyPrefix: 'q'
        }
      })
      config.set('app', {
        logger: {
          transport: 'console',
          console: {
            driver: 'console'
          }
        }
      })
      return config
    })
    ioc.alias('Adonis/Src/Config', 'Config')
    await registrar.boot()
  })
github enniel / adonis-notifications / test / unit / ChannelManager.spec.js View on Github external
ioc.singleton('Adonis/Src/Event', app => {
      const Event = require('@adonisjs/framework/src/Event')
      return new Event(app.use('Config'))
    })
    ioc.alias('Adonis/Src/Event', 'Event')
    ioc.bind('Adonis/Notifications/DatabaseNotification', () => {
      const DatabaseNotification = require('../../src/DatabaseNotification')
      DatabaseNotification._bootIfNotBooted()
      return DatabaseNotification
    })
    ioc.alias('Adonis/Notifications/DatabaseNotification', 'DatabaseNotification')
    ioc.bind('Adonis/Notifications/Notifiable', () => {
      const Notifiable = require('../../src/Notifiable')
      return new Notifiable()
    })
    ioc.alias('Adonis/Notifications/Notifiable', 'Notifiable')
    ioc.bind('Adonis/Notifications/HasDatabaseNotifications', () => {
      const HasDatabaseNotifications = require('../../src/HasDatabaseNotifications')
      return new HasDatabaseNotifications()
    })
    ioc.alias('Adonis/Notifications/HasDatabaseNotifications', 'HasDatabaseNotifications')
    await fs.ensureDir(path.join(__dirname, '../tmp'))
    const Database = use('Database')
    await fixtures.up(Database)
    setupResolver()
  })
github brainnit / adonisjs-scout / test / functional / flush.spec.js View on Github external
return config
  })
  ioc.alias('Adonis/Src/Config', 'Config')

  ioc.bind('Adonis/Src/Helpers', () => {
    return new Helpers(path.join(__dirname))
  })

  const eventMock = jest.fn()
  eventMock.on = jest.fn()
  eventMock.emit = jest.fn()
  eventMock.removeListener = jest.fn()

  ioc.bind('Adonis/Src/Event', () => eventMock)
  ioc.alias('Adonis/Src/Event', 'Event')

  await registrar
    .providers([
      '@adonisjs/lucid/providers/LucidProvider',
      path.join(__dirname, '../../providers/ScoutProvider'),
      path.join(__dirname, '../../providers/IndexKeeperProvider')
    ])
    .registerAndBoot()

  await fs.ensureDir(path.join(__dirname, '../tmp'))
  await fs.ensureDir(path.join(__dirname, 'app/Models'))

  await setup.setupTables(ioc.use('Database'))

  setupResolver()
})
github brainnit / adonisjs-scout / test / functional / scout-provider.spec.js View on Github external
beforeAll(() => {
  ioc.singleton('Adonis/Src/Env', () => new Env())
  ioc.alias('Adonis/Src/Env', 'Env')

  ioc.singleton('Adonis/Src/Config', function () {
    const config = new Config()
    config.set('scout', require('../../config'))
    return config
  })
  ioc.alias('Adonis/Src/Config', 'Config')

  const provider = new ScoutProvider(ioc)
  provider.register()
  setupResolver()
})
github brainnit / adonisjs-scout / test / functional / scout-provider.spec.js View on Github external
beforeAll(() => {
  ioc.singleton('Adonis/Src/Env', () => new Env())
  ioc.alias('Adonis/Src/Env', 'Env')

  ioc.singleton('Adonis/Src/Config', function () {
    const config = new Config()
    config.set('scout', require('../../config'))
    return config
  })
  ioc.alias('Adonis/Src/Config', 'Config')

  const provider = new ScoutProvider(ioc)
  provider.register()
  setupResolver()
})
github duyluonglc / lucid-mongo / test / unit / lucid-embeds-one.spec.js View on Github external
group.before(async () => {
    ioc.singleton('Adonis/Src/Database', function () {
      const config = new Config()
      config.set('database', {
        connection: 'testing',
        testing: helpers.getConfig()
      })
      return new DatabaseManager(config)
    })
    ioc.alias('Adonis/Src/Database', 'Database')

    await fs.ensureDir(path.join(__dirname, './tmp'))
    await helpers.createCollections(ioc.use('Adonis/Src/Database'))
  })
github enniel / adonis-notifications / test / unit / ChannelManager.spec.js View on Github external
ioc.bind('Adonis/Notifications/DatabaseNotification', () => {
      const DatabaseNotification = require('../../src/DatabaseNotification')
      DatabaseNotification._bootIfNotBooted()
      return DatabaseNotification
    })
    ioc.alias('Adonis/Notifications/DatabaseNotification', 'DatabaseNotification')
    ioc.bind('Adonis/Notifications/Notifiable', () => {
      const Notifiable = require('../../src/Notifiable')
      return new Notifiable()
    })
    ioc.alias('Adonis/Notifications/Notifiable', 'Notifiable')
    ioc.bind('Adonis/Notifications/HasDatabaseNotifications', () => {
      const HasDatabaseNotifications = require('../../src/HasDatabaseNotifications')
      return new HasDatabaseNotifications()
    })
    ioc.alias('Adonis/Notifications/HasDatabaseNotifications', 'HasDatabaseNotifications')
    await fs.ensureDir(path.join(__dirname, '../tmp'))
    const Database = use('Database')
    await fixtures.up(Database)
    setupResolver()
  })
github nrempel / adonis-kue / test / functional / commands.spec.js View on Github external
group.before(async () => {
    resolver.appNamespace('App')
    ioc.autoload(path.join(__dirname, './app'), 'App')
    registrar
      .providers([
        '@adonisjs/framework/providers/AppProvider',
        '@adonisjs/redis/providers/RedisProvider',
        path.join(__dirname, '../../providers/KueProvider'),
        path.join(__dirname, '../../providers/CommandsProvider')
      ])
      .register()
    ioc.bind('Adonis/Src/Helpers', () => {
      return new Helpers(__dirname)
    })
    ioc.alias('Adonis/Src/Helpers', 'Helpers')
    ioc.bind('Adonis/Src/Config', () => {
      const config = new Config()
      config.set('kue', {
        connection: 'kue'
      })
      config.set('redis', {
        connection: 'local',
        local: {
          host: '127.0.0.1',
          port: 6379,
          db: 0,
          keyPrefix: ''
        },
        kue: {
          host: '127.0.0.1',
          port: 6379,
github duyluonglc / lucid-mongo / test / unit / lucid-serializer.spec.js View on Github external
group.before(async () => {
    ioc.singleton('Adonis/Src/Database', function () {
      const config = new Config()
      config.set('database', {
        connection: 'testing',
        testing: helpers.getConfig()
      })
      return new DatabaseManager(config)
    })
    ioc.alias('Adonis/Src/Database', 'Database')

    await fs.ensureDir(path.join(__dirname, './tmp'))
    await helpers.createCollections(ioc.use('Adonis/Src/Database'))
  })
github adonisjs / adonis-lucid / test / unit / lucid-has-many-through.spec.js View on Github external
group.before(async () => {
    ioc.singleton('Adonis/Src/Database', function () {
      const config = new Config()
      config.set('database', {
        connection: 'testing',
        testing: helpers.getConfig()
      })
      return new DatabaseManager(config)
    })
    ioc.alias('Adonis/Src/Database', 'Database')

    await fs.ensureDir(path.join(__dirname, './tmp'))
    await helpers.createTables(ioc.use('Adonis/Src/Database'))
  })