File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments