Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
atian25 committed Mar 30, 2018
1 parent 50ee2d2 commit c46a902
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 14 deletions.
1 change: 0 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
environment:
matrix:
- nodejs_version: '6'
- nodejs_version: '8'
- nodejs_version: '9'

Expand Down
12 changes: 12 additions & 0 deletions lib/http_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
const Test = require('supertest').Test;

class EggTest extends Test {

expect(...args) {
console.log('##@', args[0], args[1]);
return super.expect(...args);
}

_assertStatus(...args) {
console.log('@@@', ...args);
const a = super._assertStatus(...args);
console.log('###', a);
return a;
}
/**
* Unexpectations:
*
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test": "npm run lint && npm run test-local && npm run test-ts",
"test-ts": "ts-node test/index.test.ts",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"cov": "egg-bin cov --full-trace",
"ci": "npm run autod --check && npm run lint && npm run cov && npm run test-ts",
"autod": "autod",
"autod-china": "autod --registry=https://registry.npm.taobao.org",
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/demo/app/controller/file.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
'use strict';

module.exports = function* () {
this.logger.warn('####### upload');
const stream = yield this.getFileStream();
this.logger.warn('####### upload stream');
const fields = stream.fields;
this.body = {
fields,
filename: stream.filename,
user: this.user,
};

this.logger.warn('####### body');
};
7 changes: 6 additions & 1 deletion test/fixtures/demo/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ module.exports = {
keepAlive: false,
},
logger: {
consoleLevel: 'NONE',
level: 'INFO',
consoleLevel: 'INFO',
coreLogger: {
level: 'INFO',
consoleLevel: 'INFO',
},
},
keys: '123',
};
22 changes: 11 additions & 11 deletions test/mock_context.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('test/mock_context.test.js', () => {
});
});

it('should work on POST file with user login', () => {
it.only('should work on POST file with user login', () => {
const ctx = app.mockContext({
user: {
foo: 'bar',
Expand All @@ -70,15 +70,15 @@ describe('test/mock_context.test.js', () => {
.post('/file')
.field('title', 'file title')
.attach('file', __filename)
.expect(200)
.expect({
fields: {
title: 'file title',
},
filename: 'mock_context.test.js',
user: {
foo: 'bar',
},
});
.expect(200);
// .expect({
// fields: {
// title: 'file title',
// },
// filename: 'mock_context.test.js',
// user: {
// foo: 'bar',
// },
// });
});
});

0 comments on commit c46a902

Please sign in to comment.