@@ -74,4 +74,38 @@ describe("ReferencesAndCitationsCardContent", () => {
74
74
const paper2 = screen . queryByText ( Papers . demoPaper2 . title , { exact : false } ) ;
75
75
expect ( paper2 ) . not . toBeInTheDocument ( ) ;
76
76
} ) ;
77
+
78
+ test ( "When references and citations are empty, then hint is shown" , async ( ) => {
79
+ render ( ReferencesAndCitationsCardContent , {
80
+ target : document . body ,
81
+ props : {
82
+ backwardReferencedPapers : Promise . resolve ( [ ] ) ,
83
+ forwardReferencedPapers : Promise . resolve ( [ ] ) ,
84
+ } ,
85
+ } ) ;
86
+
87
+ await waitForComponentLoading ( ) ;
88
+
89
+ const referencesHint = screen . getByText ( "No references found." ) ;
90
+ expect ( referencesHint ) . toBeInTheDocument ( ) ;
91
+ const citationsHint = screen . getByText ( "No citations found." ) ;
92
+ expect ( citationsHint ) . toBeInTheDocument ( ) ;
93
+ } ) ;
94
+
95
+ test ( "When loading references and citations failed, then an error hint is shown" , async ( ) => {
96
+ render ( ReferencesAndCitationsCardContent , {
97
+ target : document . body ,
98
+ props : {
99
+ backwardReferencedPapers : Promise . reject ( "error" ) ,
100
+ forwardReferencedPapers : Promise . reject ( "error" ) ,
101
+ } ,
102
+ } ) ;
103
+
104
+ await waitForComponentLoading ( ) ;
105
+
106
+ const referencesHint = screen . getByText ( "Couldn't load references." ) ;
107
+ expect ( referencesHint ) . toBeInTheDocument ( ) ;
108
+ const citationsHint = screen . getByText ( "Couldn't load citations." ) ;
109
+ expect ( citationsHint ) . toBeInTheDocument ( ) ;
110
+ } ) ;
77
111
} ) ;
0 commit comments