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)
})
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.fake('Adonis/Src/Helpers', () => new Helpers(path.join(__dirname, `./projects/${name}`)))
return ioc.use('Adonis/Src/Helpers')
ioc.bind('Adonis/Src/Helpers', () => {
return new Helpers(path.join(__dirname))
})
ioc.bind('Adonis/Src/Helpers', () => {
return new Helpers(path.join(__dirname))
})
const getContext = function () {
const command = new ace.Command()
return new Context(command, new Helpers(BASE_PATH))
}
ioc.bind('Adonis/Src/Helpers', () => new Helpers(path.join(__dirname, '..', 'app')))
ioc.bind('Adonis/Src/Helpers', () => {
return new Helpers(path.join(__dirname))
})
ioc.bind('Adonis/Src/Helpers', () => {
return new Helpers(path.join(__dirname))
})
ioc.bind('Adonis/Src/Helpers', () => {
return new Helpers(path.join(__dirname))
})