How to use the @adonisjs/lucid/lib/iocResolver.setFold function in @adonisjs/lucid

To help you get started, we’ve selected a few @adonisjs/lucid 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 adonisjs / adonis-auth / test / unit / auth-manager.spec.js View on Github external
'use strict'

/*
 * adonis-auth
 *
 * (c) Harminder Virk 
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
*/

require('@adonisjs/lucid/lib/iocResolver').setFold(require('@adonisjs/fold'))

const test = require('japa')
const AuthManager = require('../../src/Auth/Manager')
const { session: Session } = require('../../src/Schemes')
const { lucid: Lucid } = require('../../src/Serializers')
const setup = require('./setup')

test.group('AuthManager', (group) => {
  setup.hashHook(group)

  test('extend by adding a new serializer', (assert) => {
    const mongo = {}
    AuthManager.extend('mongo', mongo, 'serializer')
    assert.deepEqual(AuthManager._serializers, { mongo })
  })
github adonisjs / adonis-auth / test / unit / database-serializer.spec.js View on Github external
'use strict'

/*
 * adonis-auth
 *
 * (c) Harminder Virk 
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
*/

require('@adonisjs/lucid/lib/iocResolver').setFold(require('@adonisjs/fold'))

const test = require('japa')
const { ioc } = require('@adonisjs/fold')

const { database: DatabaseSerializer } = require('../../src/Serializers')
const setup = require('./setup')

test.group('Serializers - Database', (group) => {
  setup.databaseHook(group)
  setup.hashHook(group)

  test('generate correct query to fetch user by id', async (assert) => {
    const config = {
      uid: 'email',
      password: 'password',
      table: 'users',
github adonisjs / adonis-auth / test / unit / basicauth-scheme.spec.js View on Github external
'use strict'

/*
 * adonis-auth
 *
 * (c) Harminder Virk 
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
*/

require('@adonisjs/lucid/lib/iocResolver').setFold(require('@adonisjs/fold'))

const test = require('japa')
const { ioc } = require('@adonisjs/fold')
const Model = require('@adonisjs/lucid/src/Lucid/Model')

const { basic: BasicAuth } = require('../../src/Schemes')
const { lucid: LucidSerializer } = require('../../src/Serializers')
const setup = require('./setup')

test.group('Schemes - BasicAuth', (group) => {
  setup.databaseHook(group)
  setup.hashHook(group)

  test('throw exception when unable to validate credentials', async (assert) => {
    assert.plan(1)
github adonisjs / adonis-auth / test / unit / lucid-serializer.spec.js View on Github external
'use strict'

/*
 * adonis-auth
 *
 * (c) Harminder Virk 
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
*/

require('@adonisjs/lucid/lib/iocResolver').setFold(require('@adonisjs/fold'))

const test = require('japa')
const { ioc } = require('@adonisjs/fold')

const { lucid: LucidSerializer } = require('../../src/Serializers')
const helpers = require('./helpers')
const setup = require('./setup')

test.group('Serializers - Lucid', (group) => {
  setup.databaseHook(group)
  setup.hashHook(group)

  test('generate correct query to fetch user by id', async (assert) => {
    const User = helpers.getUserModel()
    let authQuery = null
    User.onQuery((query) => (authQuery = query))
github adonisjs / adonis-auth / test / unit / session-scheme.spec.js View on Github external
'use strict'

/*
 * adonis-auth
 *
 * (c) Harminder Virk 
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
*/

require('@adonisjs/lucid/lib/iocResolver').setFold(require('@adonisjs/fold'))

const test = require('japa')
const { ioc } = require('@adonisjs/fold')
const { Config } = require('@adonisjs/sink')

const { session: Session } = require('../../src/Schemes')
const { lucid: LucidSerializer } = require('../../src/Serializers')
const helpers = require('./helpers')
const setup = require('./setup')

test.group('Schemes - Session', (group) => {
  setup.databaseHook(group)
  setup.hashHook(group)

  test('return uid field name', async (assert) => {
    assert.plan(1)
github brainnit / adonisjs-scout / test / functional / search.spec.js View on Github external
'use strict'

require('@adonisjs/lucid/lib/iocResolver').setFold(require('@adonisjs/fold'))
const fs = require('fs-extra')
const path = require('path')
const { ioc, registrar } = require('@adonisjs/fold')
const { Config, setupResolver, Helpers } = require('@adonisjs/sink')
const Model = require('@adonisjs/lucid/src/Lucid/Model')
const setup = require('../unit/fixtures/setup')

beforeAll(async () => {
  ioc.singleton('Adonis/Src/Config', function () {
    const config = new Config()

    config.set('database', {
      connection: 'sqlite',
      sqlite: {
        client: 'sqlite',
        connection: {
github adonisjs / adonis-auth / test / unit / jwt-scheme.spec.js View on Github external
'use strict'

/*
 * adonis-auth
 *
 * (c) Harminder Virk 
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
*/

require('@adonisjs/lucid/lib/iocResolver').setFold(require('@adonisjs/fold'))

const test = require('japa')
const { ioc } = require('@adonisjs/fold')
const jwtLib = require('jsonwebtoken')

const { jwt: Jwt } = require('../../src/Schemes')
const { lucid: LucidSerializer, database: DatabaseSerializer } = require('../../src/Serializers')
const helpers = require('./helpers')
const setup = require('./setup')
const SECRET = 'averylongsecretkey'

const Encryption = {
  encrypt (token) {
    return `e${token}`
  },
github adonisjs / adonis-auth / test / functional / setup / index.js View on Github external
'use strict'

/*
 * adonis-auth
 *
 * (c) Harminder Virk 
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
*/

require('@adonisjs/lucid/lib/iocResolver').setFold(require('@adonisjs/fold'))

const { ioc, registrar } = require('@adonisjs/fold')
const path = require('path')
const Macroable = require('macroable')
const { Config } = require('@adonisjs/sink')
const helpers = require('../../unit/helpers')

class Context extends Macroable {
  static onReady () {}
}
Context._getters = {}
Context._macros = {}

module.exports = async () => {
  ioc.bind('Adonis/Src/HttpContext', () => {
    return Context
github enniel / adonis-notifications / test / unit / ChannelManager.spec.js View on Github external
'use strict'

require('@adonisjs/lucid/lib/iocResolver').setFold(require('@adonisjs/fold'))
const test = require('japa')
const fs = require('fs-extra')
const path = require('path')
const { ioc } = require('@adonisjs/fold')
const { Config, setupResolver } = require('@adonisjs/sink')
const Model = require('@adonisjs/lucid/src/Lucid/Model')
const DatabaseManager = require('@adonisjs/lucid/src/Database/Manager')
const Morphable = require('adonis-lucid-polymorphic/src/Traits/Morphable')
const ChannelManager = require('../../src/ChannelManager')
const DatabaseChannel = require('../../src/Channels/DatabaseChannel')

const fixtures = require('../fixtures')

test.group('ChannelManager', (group) => {
  group.before(async function () {
    ioc.singleton('Adonis/Src/Config', function () {
github enniel / adonis-acl / test / unit / traits.spec.js View on Github external
'use strict'

/**
 * adonis-acl
 * Copyright(c) 2017 Evgeny Razumov
 * MIT Licensed
 */

require('@adonisjs/lucid/lib/iocResolver').setFold(require('@adonisjs/fold'))
const test = require('japa')
const fs = require('fs-extra')
const path = require('path')
const Model = require('@adonisjs/lucid/src/Lucid/Model')
const DatabaseManager = require('@adonisjs/lucid/src/Database/Manager')
const BelongsToMany = require('@adonisjs/lucid/src/Lucid/Relations/BelongsToMany')
const { ioc } = require('@adonisjs/fold')
const { Config, setupResolver } = require('@adonisjs/sink')
const HasPermission = require('../../src/Traits/HasPermission')
const HasRole = require('../../src/Traits/HasRole')
const fixtures = require('../fixtures')

test.group('Traits', function (group) {
  group.before(async function () {
    ioc.singleton('Adonis/Src/Database', function () {
      const config = new Config()

@adonisjs/lucid

SQL ORM built on top of Active Record pattern

MIT
Latest version published 19 hours ago

Package Health Score

87 / 100
Full package analysis

Popular @adonisjs/lucid functions

Similar packages