describe('test/app/controller/home.test.js', () => { it('should assert', function* () { const pkg = require('../../../package.json'); assert(app.config.keys.startsWith(pkg.name)); // const ctx = app.mockContext({}); // yield ctx.service.xx(); }); it('should GET /', () => { return app.httpRequest() .get('/') .expect('hi, egg') .expect(200); }); });
export default function(app: MockApplication) { app.factory = factory; factory.define('user', app.model.User, { name: factory.sequence('User.name', n => `name_${n}`), age: 18, gender: 'male', }); factory.define('post', app.model.Post, { title: factory.sequence('Post.title', n => `title_${n}`), content: factory.chance('sentence', { word: 5 }), user_id: factory.assoc('user', 'id'), }); }
describe('test/app/middleware/robot.test.js', () => { it('should block robot', () => { return app.httpRequest() .get('/') .set('User-Agent', 'Baiduspider') .expect(403); }); });
describe('test/app/controller/home.test.js', () => { it('should assert', () => { const pkg = require('../../../package.json'); assert(app.config.keys.startsWith(pkg.name)); // const ctx = app.mockContext({}); // yield ctx.service.xx(); }); it('should GET /', () => { return app.httpRequest() .get('/') .expect(200) }); });
describe('test/app/controller/home.test.js', () => { it('should assert', function* () { const pkg = require('../../../package.json'); assert(app.config.keys.startsWith(pkg.name)); // const ctx = app.mockContext({}); // yield ctx.service.xx(); }); it('should GET /', () => { return app.httpRequest() .get('/') .expect('hi, egg') .expect(200); }); });
export default function(app: MockApplication) { app.factory = factory; factory.define('user', app.model.User, { name: factory.sequence('User.name', n => `name_${n}`), age: 18, gender: 'male', }); factory.define('post', app.model.Post, { title: factory.sequence('Post.title', n => `title_${n}`), content: factory.chance('sentence', { word: 5 }), user_id: factory.assoc('user', 'id'), }); }
describe('test/app/controller/home.test.js', () => { it('should assert', function* () { const pkg = require('../../../package.json'); assert(app.config.keys.startsWith(pkg.name)); // const ctx = app.mockContext({}); // yield ctx.service.xx(); }); it('should GET /', () => { return app.httpRequest() .get('/') .expect('hi, egg') .expect(200); }); });
describe('test/app/controller/home.test.js', () => { it('should assert', function* () { const pkg = require('../../../package.json'); assert(app.config.keys.startsWith(pkg.name)); // const ctx = app.mockContext({}); // yield ctx.service.xx(); }); it('should GET /', () => { return app.httpRequest() .get('/') .expect('hi, egg') .expect(200); }); });
describe('test/app/controller/home.test.js', () => { it('should assert', function* () { const pkg = require('../../../package.json'); assert(app.config.keys.startsWith(pkg.name)); // const ctx = app.mockContext({}); // yield ctx.service.xx(); }); it('should GET /', () => { return app.httpRequest() .get('/') .expect('hi, egg') .expect(200); }); });
describe('test/app/controller/home.test.js', () => { it('should assert', async function() { const pkg = require('../../../package.json') assert(app.config.keys.startsWith(pkg.name)) // const ctx = app.mockContext({}); // await ctx.service.xx(); }) it('should GET /', () => { return app .httpRequest() .get('/') .expect('hi, egg') .expect(200) }) })
describe('test/app/controller/home.test.js', () => { it('should assert', function* () { const pkg = require('../../../package.json'); assert(app.config.keys.startsWith(pkg.name)); // const ctx = app.mockContext({}); // yield ctx.service.xx(); }); it('should GET /', () => { return app.httpRequest() .get('/') .expect('hi, egg') .expect(200); }); });
describe('test/app/controller/home.test.js', () => { it('should assert', function* () { const pkg = require('../../../package.json'); assert(app.config.keys.startsWith(pkg.name)); // const ctx = app.mockContext({}); // yield ctx.service.xx(); }); it('should GET /', () => { return app.httpRequest() .get('/') .expect('hi, egg') .expect(200); }); });
describe('test/app/controller/home.test.js', () => { it('should assert', function* () { const pkg = require('../../../package.json'); assert(app.config.keys.startsWith(pkg.name)); // const ctx = app.mockContext({}); // yield ctx.service.xx(); }); it('should GET /', () => { return app.httpRequest() .get('/') .expect('hi, egg') .expect(200); }); });
describe('test/app/controller/home.test.js', () => { it('should assert', function* () { const pkg = require('../../../package.json'); assert(app.config.keys.startsWith(pkg.name)); // const ctx = app.mockContext({}); // yield ctx.service.xx(); }); it('should GET /', () => { return app.httpRequest() .get('/') .expect('hi, egg') .expect(200); }); });
describe('test/app/controller/home.test.js', () => { it('should assert', () => { const pkg = require('../../../package.json'); assert(app.config.keys.startsWith(pkg.name)); // const ctx = app.mockContext({}); // yield ctx.service.xx(); }); it('should GET /', () => { return app.httpRequest() .get('/') .expect('hi, egg') .expect(200); }); });