@@ -9,7 +9,7 @@ describe('ResultDisplay', () => {
99 id : 'test-id' ,
1010 name : 'Test Feed' ,
1111 url : 'https://example.com' ,
12- strategy : 'ssrf_filter ' ,
12+ strategy : 'faraday ' ,
1313 feed_token : 'test-feed-token' ,
1414 public_url : 'https://example.com/feed.xml' ,
1515 json_public_url : 'https://example.com/feed.json' ,
@@ -21,28 +21,44 @@ describe('ResultDisplay', () => {
2121 ok : true ,
2222 json : async ( ) => ( {
2323 items : [
24- { title : 'Item One' } ,
25- { content_text : '56 points by canpan 1 hour ago | hide | 18 comments' } ,
26- { content_text : '2. Item Two ( example.com )' } ,
24+ {
25+ title : 'Item One' ,
26+ content_text : '<p>First preview item with <strong>markup</strong>.</p>' ,
27+ url : 'https://example.com/item-one' ,
28+ date_published : '2024-01-01T00:00:00Z' ,
29+ } ,
30+ {
31+ content_text : '56 points by canpan 1 hour ago | hide | 18 comments' ,
32+ date_published : '2024-01-02T00:00:00Z' ,
33+ } ,
34+ {
35+ content_text : '2. Item Two ( example.com )' ,
36+ url : 'https://example.com/item-two' ,
37+ date_published : '2024-01-03T00:00:00Z' ,
38+ } ,
2739 ] ,
2840 } ) ,
2941 } as Response ) ;
3042 } ) ;
3143
32- it ( 'renders the simplified result actions and preview' , async ( ) => {
44+ it ( 'renders the success state actions and richer preview cards ' , async ( ) => {
3345 render ( < ResultDisplay result = { mockResult } onCreateAnother = { mockOnCreateAnother } /> ) ;
3446
47+ expect ( screen . getByText ( 'Your feed is ready' ) ) . toBeInTheDocument ( ) ;
3548 expect ( screen . getByText ( 'Test Feed' ) ) . toBeInTheDocument ( ) ;
3649 expect ( screen . getByRole ( 'button' , { name : 'Copy feed URL' } ) ) . toBeInTheDocument ( ) ;
3750 expect ( screen . getByRole ( 'link' , { name : 'Open feed' } ) ) . toBeInTheDocument ( ) ;
38- expect ( screen . getByRole ( 'link' , { name : 'JSON Feed' } ) ) . toHaveAttribute (
51+ expect ( screen . getByRole ( 'link' , { name : 'Open JSON Feed' } ) ) . toHaveAttribute (
3952 'href' ,
4053 'https://example.com/feed.json'
4154 ) ;
4255 await waitFor ( ( ) => {
4356 expect ( screen . getByText ( 'Item One' ) ) . toBeInTheDocument ( ) ;
57+ expect ( screen . getByText ( 'First preview item with markup.' ) ) . toBeInTheDocument ( ) ;
58+ expect ( screen . getAllByText ( 'Open original' ) ) . toHaveLength ( 2 ) ;
4459 expect ( screen . getByText ( / p o i n t s b y c a n p a n / i) ) . toBeInTheDocument ( ) ;
4560 expect ( screen . getByText ( 'Item Two' ) ) . toBeInTheDocument ( ) ;
61+ expect ( screen . getByText ( 'Latest items from this feed' ) ) . toBeInTheDocument ( ) ;
4662 } ) ;
4763 expect ( window . fetch ) . toHaveBeenCalledWith ( 'https://example.com/feed.xml' , {
4864 headers : { Accept : 'application/feed+json' } ,
@@ -59,6 +75,7 @@ describe('ResultDisplay', () => {
5975
6076 await waitFor ( ( ) => {
6177 expect ( screen . getByText ( 'Preview unavailable right now.' ) ) . toBeInTheDocument ( ) ;
78+ expect ( screen . getByText ( 'Latest items from this feed' ) ) . toBeInTheDocument ( ) ;
6279 } ) ;
6380 } ) ;
6481
0 commit comments