@@ -1004,6 +1004,19 @@ describe('API description namespace', () => {
10041004 } ,
10051005 } ,
10061006 } ,
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+ } ,
10071020 {
10081021 element : 'transition' ,
10091022 attributes : {
@@ -1040,7 +1053,7 @@ describe('API description namespace', () => {
10401053
10411054 it ( 'should contain members' , ( ) => {
10421055 const { members } = authScheme ;
1043- expect ( members ) . to . have . length ( 1 ) ;
1056+ expect ( members ) . to . have . length ( 2 ) ;
10441057 members . forEach ( ( item ) => {
10451058 expect ( item ) . to . be . an . instanceof ( MemberElement ) ;
10461059 } ) ;
@@ -1053,6 +1066,56 @@ describe('API description namespace', () => {
10531066 expect ( item ) . to . be . an . instanceof ( Transition ) ;
10541067 } ) ;
10551068 } ) ;
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+ } ) ;
10561119 } ) ;
10571120
10581121 context ( 'HTTP transaction element' , ( ) => {
0 commit comments