@@ -1004,6 +1004,19 @@ describe('API description namespace', () => {
1004
1004
} ,
1005
1005
} ,
1006
1006
} ,
1007
+ {
1008
+ element : 'member' ,
1009
+ content : {
1010
+ key : {
1011
+ element : 'string' ,
1012
+ content : 'grantType' ,
1013
+ } ,
1014
+ value : {
1015
+ element : 'string' ,
1016
+ content : 'token' ,
1017
+ } ,
1018
+ } ,
1019
+ } ,
1007
1020
{
1008
1021
element : 'transition' ,
1009
1022
attributes : {
@@ -1040,7 +1053,7 @@ describe('API description namespace', () => {
1040
1053
1041
1054
it ( 'should contain members' , ( ) => {
1042
1055
const { members } = authScheme ;
1043
- expect ( members ) . to . have . length ( 1 ) ;
1056
+ expect ( members ) . to . have . length ( 2 ) ;
1044
1057
members . forEach ( ( item ) => {
1045
1058
expect ( item ) . to . be . an . instanceof ( MemberElement ) ;
1046
1059
} ) ;
@@ -1053,6 +1066,56 @@ describe('API description namespace', () => {
1053
1066
expect ( item ) . to . be . an . instanceof ( Transition ) ;
1054
1067
} ) ;
1055
1068
} ) ;
1069
+
1070
+ it ( 'should retrieve grant type' , ( ) => {
1071
+ expect ( authScheme . grantType ) . to . equal ( 'token' ) ;
1072
+ } ) ;
1073
+
1074
+ it ( 'without grant type should return undefined' , ( ) => {
1075
+ const refracted = {
1076
+ element : 'Token Auth Scheme' ,
1077
+ meta : {
1078
+ id : {
1079
+ element : 'string' ,
1080
+ content : 'Custom Token Auth' ,
1081
+ } ,
1082
+ } ,
1083
+ content : [ ] ,
1084
+ } ;
1085
+
1086
+ const element = namespace . fromRefract ( refracted ) ;
1087
+ const authScheme = new AuthScheme ( element . content , element . meta , element . attributes ) ;
1088
+
1089
+ expect ( authScheme . grantType ) . to . be . undefined ;
1090
+ } ) ;
1091
+
1092
+ it ( 'without grant type value should return undefined' , ( ) => {
1093
+ const refracted = {
1094
+ element : 'Token Auth Scheme' ,
1095
+ meta : {
1096
+ id : {
1097
+ element : 'string' ,
1098
+ content : 'Custom Token Auth' ,
1099
+ } ,
1100
+ } ,
1101
+ content : [
1102
+ {
1103
+ element : 'member' ,
1104
+ content : {
1105
+ key : {
1106
+ element : 'string' ,
1107
+ content : 'grantType' ,
1108
+ } ,
1109
+ } ,
1110
+ } ,
1111
+ ] ,
1112
+ } ;
1113
+
1114
+ const element = namespace . fromRefract ( refracted ) ;
1115
+ const authScheme = new AuthScheme ( element . content , element . meta , element . attributes ) ;
1116
+
1117
+ expect ( authScheme . grantType ) . to . be . undefined ;
1118
+ } ) ;
1056
1119
} ) ;
1057
1120
1058
1121
context ( 'HTTP transaction element' , ( ) => {
0 commit comments