Skip to content

Commit 58ba227

Browse files
committed
Add test
1 parent 9b38134 commit 58ba227

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"babel-preset-es2015": "6.24.1",
4242
"babel-preset-react": "6.24.1",
4343
"babel-preset-stage-1": "6.24.1",
44+
"chai": "^4.1.2",
4445
"coveralls": "^2.13.1",
4546
"cross-env": "5.0.5",
4647
"enzyme": "^2.9.1",

tests/component.property.test.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React from 'react';
2+
import TwitterLogin from 'TwitterLogin';
3+
import { expect } from 'chai';
4+
import { mount } from 'enzyme';
5+
6+
describe('Twitter Login Component', () => {
7+
8+
let component;
9+
let propsObj;
10+
11+
describe('With default props',() => {
12+
beforeEach(() => {
13+
propsObj = {
14+
onSuccess: (response) => {},
15+
onFailure: (error) => {},
16+
loginUrl: 'http://localhost:3000/login-url',
17+
requestTokenUrl: 'http://localhost:3000/request-token'
18+
};
19+
component = mount(<TwitterLogin {...propsObj}/>);
20+
});
21+
22+
it('shows the button', () => {
23+
expect(component).to.exist;
24+
});
25+
26+
it('displays correct button default values', () => {
27+
expect(component.props().text).to.equal('Sign in with Twitter');
28+
expect(component.props().tag).to.equal('button');
29+
expect(component.props().disabled).to.equal(false);
30+
expect(component.props().dialogWidth).to.equal(600);
31+
expect(component.props().dialogHeight).to.equal(400);
32+
});
33+
34+
35+
36+
})
37+
});

0 commit comments

Comments
 (0)