test: update upload test
parent
843d9dc82f
commit
cdc0e1a5f6
|
@ -0,0 +1,14 @@
|
|||
import mock from 'xhr-mock';
|
||||
|
||||
export function setup() {
|
||||
mock.setup();
|
||||
mock.post('http://upload.com/', (req, res) => {
|
||||
req.headers({
|
||||
'content-length': 100,
|
||||
});
|
||||
req.body('thisisbody');
|
||||
return res;
|
||||
});
|
||||
}
|
||||
|
||||
export const teardown = mock.teardown.bind(mock);
|
|
@ -3,10 +3,13 @@ import Upload from '..';
|
|||
import { T, fileToObject, genPercentAdd, getFileItem, removeFileItem } from '../utils';
|
||||
import PropsTypes from '../../_util/vue-types';
|
||||
import { UploadListProps } from '../interface';
|
||||
import { setup, teardown } from './mock';
|
||||
|
||||
UploadListProps.items = PropsTypes.any;
|
||||
|
||||
describe('Upload', () => {
|
||||
beforeEach(() => setup());
|
||||
afterEach(() => teardown());
|
||||
it('should get refs inside Upload in componentDidMount', () => {
|
||||
let ref = null;
|
||||
const APP = {
|
||||
|
|
|
@ -176,7 +176,8 @@
|
|||
"webpack-cli": "^3.2.1",
|
||||
"webpack-dev-server": "^3.1.14",
|
||||
"webpack-merge": "^4.1.1",
|
||||
"webpackbar": "^3.1.5"
|
||||
"webpackbar": "^3.1.5",
|
||||
"xhr-mock": "^2.5.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^2.1.1",
|
||||
|
|
Loading…
Reference in New Issue