11import Log from '../src/Log' ;
22import SigninResponse from '../src/SigninResponse' ;
3+ import SigninResponseError from '../src/SigninResponseError' ;
34
45import chai from 'chai' ;
56chai . should ( ) ;
@@ -14,38 +15,16 @@ describe("SigninResponse", function() {
1415 subject . state . should . equal ( "foo" ) ;
1516 } ) ;
1617
17- it ( "should read error" , function ( ) {
18- let subject = new SigninResponse ( "error=foo" ) ;
19- subject . error . should . equal ( "foo" ) ;
20- } ) ;
21-
22- it ( "should read error_description" , function ( ) {
23- let subject = new SigninResponse ( "error=error&error_description=foo" ) ;
24- subject . error_description . should . equal ( "foo" ) ;
18+ it ( "should return SigninResponse if no error" , function ( ) {
19+ let subject = new SigninResponse ( "" ) ;
20+ subject . should . be . instanceof ( SigninResponse ) ;
2521 } ) ;
2622
27- it ( "should read error_uri " , function ( ) {
28- let subject = new SigninResponse ( "error=error&error_uri= foo" ) ;
29- subject . error_uri . should . equal ( "foo" ) ;
23+ it ( "should return SigninResponseError if error " , function ( ) {
24+ let subject = new SigninResponse ( "error=foo" ) ;
25+ subject . should . be . instanceof ( SigninResponseError ) ;
3026 } ) ;
3127
32- it ( "should only read error info if error" , function ( ) {
33- let subject = new SigninResponse ( "error_description=foo" ) ;
34- expect ( subject . error_description ) . to . be . undefined ;
35-
36- subject = new SigninResponse ( "error_uri=foo" ) ;
37- expect ( subject . error_uri ) . to . be . undefined ;
38-
39- subject = new SigninResponse ( "error=error&id_token=foo&session_state=foo&access_token=foo&token_type=foo&scope=foo&expires_in=10" ) ;
40- expect ( subject . id_token ) . to . be . undefined ;
41- expect ( subject . session_state ) . to . be . undefined ;
42- expect ( subject . access_token ) . to . be . undefined ;
43- expect ( subject . token_type ) . to . be . undefined ;
44- expect ( subject . scope ) . to . be . undefined ;
45- expect ( subject . expires_in ) . to . be . undefined ;
46- expect ( subject . expires_at ) . to . be . undefined ;
47- } ) ;
48-
4928 it ( "should read id_token" , function ( ) {
5029 let subject = new SigninResponse ( "id_token=foo" ) ;
5130 subject . id_token . should . equal ( "foo" ) ;
0 commit comments