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 { T, fileToObject, genPercentAdd, getFileItem, removeFileItem } from '../utils';
|
||||||
import PropsTypes from '../../_util/vue-types';
|
import PropsTypes from '../../_util/vue-types';
|
||||||
import { UploadListProps } from '../interface';
|
import { UploadListProps } from '../interface';
|
||||||
|
import { setup, teardown } from './mock';
|
||||||
|
|
||||||
UploadListProps.items = PropsTypes.any;
|
UploadListProps.items = PropsTypes.any;
|
||||||
|
|
||||||
describe('Upload', () => {
|
describe('Upload', () => {
|
||||||
|
beforeEach(() => setup());
|
||||||
|
afterEach(() => teardown());
|
||||||
it('should get refs inside Upload in componentDidMount', () => {
|
it('should get refs inside Upload in componentDidMount', () => {
|
||||||
let ref = null;
|
let ref = null;
|
||||||
const APP = {
|
const APP = {
|
||||||
|
|
|
@ -176,7 +176,8 @@
|
||||||
"webpack-cli": "^3.2.1",
|
"webpack-cli": "^3.2.1",
|
||||||
"webpack-dev-server": "^3.1.14",
|
"webpack-dev-server": "^3.1.14",
|
||||||
"webpack-merge": "^4.1.1",
|
"webpack-merge": "^4.1.1",
|
||||||
"webpackbar": "^3.1.5"
|
"webpackbar": "^3.1.5",
|
||||||
|
"xhr-mock": "^2.5.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ant-design/icons": "^2.1.1",
|
"@ant-design/icons": "^2.1.1",
|
||||||
|
|
Loading…
Reference in New Issue