Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
xuqiang1227 committed Mar 12, 2018
1 parent 1640d40 commit 6de733c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/components/Example.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import 'raf/polyfill';
import { shallow } from 'enzyme';
import Example from '../../src/components/Example';

Expand Down
37 changes: 37 additions & 0 deletions tests/models/login.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import 'babel-polyfill';
import 'raf/polyfill';
import React from 'react';
import chai from 'chai';
import LoginModel from '../../src/models/login';

describe('models/login', () => {
describe('test namespace', () => {
it('The namespace validate for this model:', () => {
chai.expect(LoginModel.namespace).to.equals('login');
});
});
describe('test states', () => {
it('validate initial state.', () => {
chai.expect(LoginModel.state).to.be.an('object').that.have.property('changeLoginStatus');
chai.expect(LoginModel.state).to.deep.equals({
changeLoginStatus: {},
user: []
});
});
});

describe('test reducers', () => {
it('validate reducer function:', () => {
chai.expect(LoginModel.reducers).to.be.an('object').that.have.property('setState');
chai.expect(LoginModel.reducers.setState({}, {payload: {test: {}}})).to.deep.equals({test: {}});
});
});

describe('test effects', function() {
it('validate effects function:', function() {
chai.expect(LoginModel.effects).to.be.an('object').that.have.property('accountSubmit');
const accountSubmit = LoginModel.effects.accountSubmit;
yield accountSubmit({payload: {username: '8888'}})
});
});
});
2 changes: 1 addition & 1 deletion tests/utils/validator.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'babel-polyfill';
import 'raf/polyfill';
import {checkUsername} from '../../src/utils/validator';
import chai from 'chai';
const {expect} = chai;
Expand Down

0 comments on commit 6de733c

Please sign in to comment.