@@ -27,6 +27,8 @@ import * as identity from "../../../src/common/providers/identity";
27
27
const EVENT = "EVENT_TYPE" ;
28
28
const now = new Date ( ) ;
29
29
const TEST_NAME = "John Doe" ;
30
+ const ALLOW = "ALLOW" ;
31
+ const BLOCK = "BLOCK" ;
30
32
31
33
describe ( "identity" , ( ) => {
32
34
describe ( "userRecordConstructor" , ( ) => {
@@ -771,24 +773,24 @@ describe("identity", () => {
771
773
} ) ;
772
774
} ) ;
773
775
774
- describe ( "generateRequestPayload " , ( ) => {
776
+ describe ( "generateResponsePayload " , ( ) => {
775
777
const DISPLAY_NAME_FIELD = "displayName" ;
776
778
const TEST_RESPONSE = {
777
779
displayName : TEST_NAME ,
778
- recaptchaPassed : false ,
780
+ recaptchaActionOverride : BLOCK ,
779
781
} as identity . BeforeCreateResponse ;
780
782
781
783
const EXPECT_PAYLOAD = {
782
784
userRecord : { displayName : TEST_NAME , updateMask : DISPLAY_NAME_FIELD } ,
783
- recaptchaPassed : false ,
785
+ recaptchaActionOverride : BLOCK ,
784
786
} ;
785
787
786
- const TEST_RESPONSE_RECAPTCHA_TRUE = {
787
- recaptchaPassed : true ,
788
+ const TEST_RESPONSE_RECAPTCHA_ALLOW = {
789
+ recaptchaActionOverride : ALLOW ,
788
790
} as identity . BeforeCreateResponse ;
789
791
790
- const EXPECT_PAYLOAD_RECAPTCHA_TRUE = {
791
- recaptchaPassed : true ,
792
+ const EXPECT_PAYLOAD_RECAPTCHA_ALLOW = {
793
+ recaptchaActionOverride : ALLOW ,
792
794
} ;
793
795
794
796
const TEST_RESPONSE_RECAPTCHA_UNDEFINED = {
@@ -802,19 +804,19 @@ describe("identity", () => {
802
804
expect ( identity . generateResponsePayload ( ) ) . to . eql ( { } ) ;
803
805
} ) ;
804
806
805
- it ( "should exclude recaptchaPass field from updateMask" , ( ) => {
807
+ it ( "should exclude recaptchaActionOverride field from updateMask" , ( ) => {
806
808
expect ( identity . generateResponsePayload ( TEST_RESPONSE ) ) . to . deep . equal ( EXPECT_PAYLOAD ) ;
807
809
} ) ;
808
810
809
- it ( "should return recaptchaPass when it is true on response" , ( ) => {
810
- expect ( identity . generateResponsePayload ( TEST_RESPONSE_RECAPTCHA_TRUE ) ) . to . deep . equal (
811
- EXPECT_PAYLOAD_RECAPTCHA_TRUE
811
+ it ( "should return recaptchaActionOverride when it is true on response" , ( ) => {
812
+ expect ( identity . generateResponsePayload ( TEST_RESPONSE_RECAPTCHA_ALLOW ) ) . to . deep . equal (
813
+ EXPECT_PAYLOAD_RECAPTCHA_ALLOW
812
814
) ;
813
815
} ) ;
814
816
815
- it ( "should not return recaptchaPass if undefined" , ( ) => {
817
+ it ( "should not return recaptchaActionOverride if undefined" , ( ) => {
816
818
const payload = identity . generateResponsePayload ( TEST_RESPONSE_RECAPTCHA_UNDEFINED ) ;
817
- expect ( payload . hasOwnProperty ( "recaptchaPassed " ) ) . to . be . false ;
819
+ expect ( payload . hasOwnProperty ( "recaptchaActionOverride " ) ) . to . be . false ;
818
820
expect ( payload ) . to . deep . equal ( EXPECT_PAYLOAD_UNDEFINED ) ;
819
821
} ) ;
820
822
} ) ;
0 commit comments