@@ -23,6 +23,66 @@ context("Candidacy Banner Display Logic", () => {
23
23
} ) ;
24
24
} ) ;
25
25
26
+ describe ( "Pending Contestation Caducite Banner" , ( ) => {
27
+ it ( "should display pending contestation banner and hide other banners when candidacy has pending contestation" , ( ) => {
28
+ cy . fixture ( "candidate1.json" ) . then ( ( candidate ) => {
29
+ candidate . data . candidate_getCandidateWithCandidacy . candidacy . isCaduque = true ;
30
+ candidate . data . candidate_getCandidateWithCandidacy . candidacy . candidacyContestationsCaducite =
31
+ [
32
+ {
33
+ certificationAuthorityContestationDecision : "DECISION_PENDING" ,
34
+ contestationSentAt : new Date ( ) . getTime ( ) ,
35
+ } ,
36
+ ] ;
37
+
38
+ cy . intercept ( "POST" , "/api/graphql" , ( req ) => {
39
+ stubQuery ( req , "candidate_getCandidateWithCandidacy" , candidate ) ;
40
+ } ) ;
41
+ } ) ;
42
+
43
+ cy . login ( ) ;
44
+ cy . wait ( "@candidate_login" ) ;
45
+ cy . wait ( "@candidate_getCandidateWithCandidacy" ) ;
46
+ cy . wait ( "@activeFeaturesForConnectedUser" ) ;
47
+
48
+ cy . get ( '[data-test="pending-contestation-caducite-banner"]' ) . should (
49
+ "exist" ,
50
+ ) ;
51
+ cy . get ( '[data-test="caduque-banner"]' ) . should ( "not.exist" ) ;
52
+ cy . get ( '[data-test="actualisation-banner"]' ) . should ( "not.exist" ) ;
53
+ cy . get ( '[data-test="welcome-banner"]' ) . should ( "not.exist" ) ;
54
+ } ) ;
55
+
56
+ it ( "should display the correct contestation sent date" , ( ) => {
57
+ const contestationDate = new Date ( 2023 , 0 , 15 ) . getTime ( ) ;
58
+
59
+ cy . fixture ( "candidate1.json" ) . then ( ( candidate ) => {
60
+ candidate . data . candidate_getCandidateWithCandidacy . candidacy . isCaduque = true ;
61
+ candidate . data . candidate_getCandidateWithCandidacy . candidacy . candidacyContestationsCaducite =
62
+ [
63
+ {
64
+ certificationAuthorityContestationDecision : "DECISION_PENDING" ,
65
+ contestationSentAt : contestationDate ,
66
+ } ,
67
+ ] ;
68
+
69
+ cy . intercept ( "POST" , "/api/graphql" , ( req ) => {
70
+ stubQuery ( req , "candidate_getCandidateWithCandidacy" , candidate ) ;
71
+ } ) ;
72
+ } ) ;
73
+
74
+ cy . login ( ) ;
75
+ cy . wait ( "@candidate_login" ) ;
76
+ cy . wait ( "@candidate_getCandidateWithCandidacy" ) ;
77
+ cy . wait ( "@activeFeaturesForConnectedUser" ) ;
78
+
79
+ cy . get ( '[data-test="pending-contestation-caducite-banner"]' ) . should (
80
+ "contain" ,
81
+ "15/01/2023" ,
82
+ ) ;
83
+ } ) ;
84
+ } ) ;
85
+
26
86
describe ( "Caduque Banner" , ( ) => {
27
87
VALID_STATUSES . forEach ( ( status ) => {
28
88
it ( `should display caduque banner and hide other banners when candidacy is caduque with ${ status } status` , ( ) => {
0 commit comments