Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('make a model filter class', async (assert) => {
const make = new MakeModelFilter(new Helpers(path.join(__dirname)))
// Name without word 'Filter'
await make.handle({ name: 'User' })
const UserFilter = require(path.join(__dirname, './app/ModelFilters/UserFilter'))
// Name with word 'Filter'
await make.handle({ name: 'PostFilter' })
const PostFilter = require(path.join(__dirname, './app/ModelFilters/PostFilter'))
assert.equal(UserFilter.name, 'UserFilter')
assert.equal(PostFilter.name, 'PostFilter')
assert.instanceOf(new UserFilter(), ModelFilter)
})
import { tasks } from './tasks'
import { CliState } from './src/contracts'
const USING_YARN = !!(process.env.npm_execpath && process.env.npm_execpath.includes('yarn'))
/* eslint-disable-next-line */
const BADGE = " _ _ _ _ \n / \\ __| | ___ _ __ (_)___ | |___ \n / _ \\ / _` |/ _ \\| '_ \\| / __|_ | / __|\n / ___ \\ (_| | (_) | | | | \\__ \\ |_| \\__ \\\n/_/ \\_\\__,_|\\___/|_| |_|_|___/\\___/|___/\n"
/**
* Help screen output
*/
const HELP = `${colors.green(USING_YARN ? 'yarn create adonis-ts-app' : 'npx create-adonis-ts-app')} ${colors.dim('')}
${colors.yellow('Options')}
${colors.green('--boilerplate')} ${colors.green('')} ${colors.dim('Choose API boilerplate')}
${colors.green('--name')} ${colors.green('')} ${colors.dim('Define custom application name')}
${colors.green('--eslint')} ${colors.green('')} ${colors.dim('Enable/disable eslint setup')}
`
/**
* Running all the tasks to create a new project.
*/
export async function runTasks (args: string[]) {
const argv = getops(args, {
string: ['boilerplate', 'name'],
boolean: ['eslint'],
default: {
eslint: null,
},
})
console.log(BADGE)
import { CliState } from './src/contracts'
const USING_YARN = !!(process.env.npm_execpath && process.env.npm_execpath.includes('yarn'))
/* eslint-disable-next-line */
const BADGE = " _ _ _ _ \n / \\ __| | ___ _ __ (_)___ | |___ \n / _ \\ / _` |/ _ \\| '_ \\| / __|_ | / __|\n / ___ \\ (_| | (_) | | | | \\__ \\ |_| \\__ \\\n/_/ \\_\\__,_|\\___/|_| |_|_|___/\\___/|___/\n"
/**
* Help screen output
*/
const HELP = `${colors.green(USING_YARN ? 'yarn create adonis-ts-app' : 'npx create-adonis-ts-app')} ${colors.dim('')}
${colors.yellow('Options')}
${colors.green('--boilerplate')} ${colors.green('')} ${colors.dim('Choose API boilerplate')}
${colors.green('--name')} ${colors.green('')} ${colors.dim('Define custom application name')}
${colors.green('--eslint')} ${colors.green('')} ${colors.dim('Enable/disable eslint setup')}
`
/**
* Running all the tasks to create a new project.
*/
export async function runTasks (args: string[]) {
const argv = getops(args, {
string: ['boilerplate', 'name'],
boolean: ['eslint'],
default: {
eslint: null,
},
})
console.log(BADGE)
import { isEmptyDir, logger, colors } from '@adonisjs/sink'
import { ensureDirSync, removeSync } from 'fs-extra'
import { Application } from '@adonisjs/application/build/standalone'
import { tasks } from './tasks'
import { CliState } from './src/contracts'
const USING_YARN = !!(process.env.npm_execpath && process.env.npm_execpath.includes('yarn'))
/* eslint-disable-next-line */
const BADGE = " _ _ _ _ \n / \\ __| | ___ _ __ (_)___ | |___ \n / _ \\ / _` |/ _ \\| '_ \\| / __|_ | / __|\n / ___ \\ (_| | (_) | | | | \\__ \\ |_| \\__ \\\n/_/ \\_\\__,_|\\___/|_| |_|_|___/\\___/|___/\n"
/**
* Help screen output
*/
const HELP = `${colors.green(USING_YARN ? 'yarn create adonis-ts-app' : 'npx create-adonis-ts-app')} ${colors.dim('')}
${colors.yellow('Options')}
${colors.green('--boilerplate')} ${colors.green('')} ${colors.dim('Choose API boilerplate')}
${colors.green('--name')} ${colors.green('')} ${colors.dim('Define custom application name')}
${colors.green('--eslint')} ${colors.green('')} ${colors.dim('Enable/disable eslint setup')}
`
/**
* Running all the tasks to create a new project.
*/
export async function runTasks (args: string[]) {
const argv = getops(args, {
string: ['boilerplate', 'name'],
boolean: ['eslint'],
default: {
eslint: null,
import { tasks } from './tasks'
import { CliState } from './src/contracts'
const USING_YARN = !!(process.env.npm_execpath && process.env.npm_execpath.includes('yarn'))
/* eslint-disable-next-line */
const BADGE = " _ _ _ _ \n / \\ __| | ___ _ __ (_)___ | |___ \n / _ \\ / _` |/ _ \\| '_ \\| / __|_ | / __|\n / ___ \\ (_| | (_) | | | | \\__ \\ |_| \\__ \\\n/_/ \\_\\__,_|\\___/|_| |_|_|___/\\___/|___/\n"
/**
* Help screen output
*/
const HELP = `${colors.green(USING_YARN ? 'yarn create adonis-ts-app' : 'npx create-adonis-ts-app')} ${colors.dim('')}
${colors.yellow('Options')}
${colors.green('--boilerplate')} ${colors.green('')} ${colors.dim('Choose API boilerplate')}
${colors.green('--name')} ${colors.green('')} ${colors.dim('Define custom application name')}
${colors.green('--eslint')} ${colors.green('')} ${colors.dim('Enable/disable eslint setup')}
`
/**
* Running all the tasks to create a new project.
*/
export async function runTasks (args: string[]) {
const argv = getops(args, {
string: ['boilerplate', 'name'],
boolean: ['eslint'],
default: {
eslint: null,
},
})
import { Application } from '@adonisjs/application/build/standalone'
import { tasks } from './tasks'
import { CliState } from './src/contracts'
const USING_YARN = !!(process.env.npm_execpath && process.env.npm_execpath.includes('yarn'))
/* eslint-disable-next-line */
const BADGE = " _ _ _ _ \n / \\ __| | ___ _ __ (_)___ | |___ \n / _ \\ / _` |/ _ \\| '_ \\| / __|_ | / __|\n / ___ \\ (_| | (_) | | | | \\__ \\ |_| \\__ \\\n/_/ \\_\\__,_|\\___/|_| |_|_|___/\\___/|___/\n"
/**
* Help screen output
*/
const HELP = `${colors.green(USING_YARN ? 'yarn create adonis-ts-app' : 'npx create-adonis-ts-app')} ${colors.dim('')}
${colors.yellow('Options')}
${colors.green('--boilerplate')} ${colors.green('')} ${colors.dim('Choose API boilerplate')}
${colors.green('--name')} ${colors.green('')} ${colors.dim('Define custom application name')}
${colors.green('--eslint')} ${colors.green('')} ${colors.dim('Enable/disable eslint setup')}
`
/**
* Running all the tasks to create a new project.
*/
export async function runTasks (args: string[]) {
const argv = getops(args, {
string: ['boilerplate', 'name'],
boolean: ['eslint'],
default: {
eslint: null,
},
})
test('return decrypted x-xsrf-token', async (assert) => {
const config = new Config()
const shield = new Shield(config)
const request = getReq()
request.headers = { 'x-xsrf-token': '12' }
assert.equal(shield.getCsrfToken(request), '12')
})
it('throw exception when unable to find engine', () => {
const config = new Config()
const scout = new Scout(config)
const fn = () => scout.engine()
expect(fn).toThrow('E_INVALID_PARAMETER: Make sure to define connection inside config/scout.js file')
})
test('make a validator class', async (assert) => {
const make = new MakeValidator(new Helpers(path.join(__dirname)))
await make.handle({ name: 'User' })
const User = require(path.join(__dirname, './app/Validators/User'))
assert.equal(User.name, 'User')
assert.deepEqual(new User().rules, {})
})
ioc.bind('Adonis/Src/Config', () => {
const config = new Config()
config.set('database', {
connection: 'testing',
testing: helpers.getConfig()
})
return config
})