@@ -168,14 +168,15 @@ describe(`sessionClaims/createNewSession: ${printPath("[test/session/claims/crea
168168 if ( maxVersion ( apiVersion , "2.12" ) === "2.12" ) {
169169 return ;
170170 }
171+ const includesNullInPayload = maxVersion ( apiVersion , "2.14" ) !== "2.14" ;
171172 const response = mockResponse ( ) ;
172173 const res = await Session . createNewSession ( response , "someId" , payloadParam ) ;
173174
174175 // The passed object should be unchanged
175176 assert . strictEqual ( Object . keys ( payloadParam ) . length , 1 ) ;
176177
177178 const payload = res . getAccessTokenPayload ( ) ;
178- assert . strictEqual ( Object . keys ( payload ) . length , 5 ) ;
179+ assert . strictEqual ( Object . keys ( payload ) . length , includesNullInPayload ? 5 : 4 ) ;
179180 // We have the prop from the payload param
180181 assert . strictEqual ( payload [ "initial" ] , true ) ;
181182 // We have the boolean claim
@@ -185,11 +186,18 @@ describe(`sessionClaims/createNewSession: ${printPath("[test/session/claims/crea
185186 // We have the custom claim
186187 // The resulting payload is different from the input: it doesn't container undefined
187188 assert . deepStrictEqual ( payload [ "user-custom" ] , "asdf" ) ;
188- assert . deepStrictEqual ( payload [ "user-custom2" ] , {
189- inner : "asdf" ,
190- nullProp : null ,
191- } ) ;
192- assert . deepStrictEqual ( payload [ "user-custom3" ] , null ) ;
189+ if ( includesNullInPayload ) {
190+ assert . deepStrictEqual ( payload [ "user-custom2" ] , {
191+ inner : "asdf" ,
192+ nullProp : null ,
193+ } ) ;
194+ assert . deepStrictEqual ( payload [ "user-custom3" ] , null ) ;
195+ } else {
196+ assert . deepStrictEqual ( payload [ "user-custom2" ] , {
197+ inner : "asdf" ,
198+ } ) ;
199+ assert . deepStrictEqual ( payload [ "user-custom3" ] , undefined ) ;
200+ }
193201 } ) ;
194202 } ) ;
195203} ) ;
0 commit comments