@@ -83,24 +83,27 @@ describe('App', () => {
8383 } ) ;
8484 } ) ;
8585
86- it ( 'renders the streamlined hero and create section ' , ( ) => {
86+ it ( 'renders the radical-simple create flow ' , ( ) => {
8787 render ( < App /> ) ;
8888
89- expect ( screen . getByText ( 'Create a feed URL.' ) ) . toBeInTheDocument ( ) ;
90- expect ( screen . getByLabelText ( 'Source URL' ) ) . toBeInTheDocument ( ) ;
91- expect ( screen . getByText ( 'Run your own instance' ) ) . toBeInTheDocument ( ) ;
89+ expect ( screen . getByLabelText ( 'html2rss' ) ) . toBeInTheDocument ( ) ;
90+ expect ( screen . getByLabelText ( 'Page URL' ) ) . toBeInTheDocument ( ) ;
91+ expect ( screen . getByRole ( 'button' , { name : 'More' } ) ) . toBeInTheDocument ( ) ;
92+ expect ( screen . queryByRole ( 'link' , { name : 'Bookmarklet' } ) ) . not . toBeInTheDocument ( ) ;
9293 } ) ;
9394
94- it ( 'autofocuses the source url field' , ( ) => {
95+ it ( 'autofocuses the source url field' , async ( ) => {
9596 render ( < App /> ) ;
9697
97- expect ( document . activeElement ) . toBe ( screen . getByLabelText ( 'Source URL' ) ) ;
98+ await waitFor ( ( ) => {
99+ expect ( document . activeElement ) . toBe ( screen . getByLabelText ( 'Page URL' ) ) ;
100+ } ) ;
98101 } ) ;
99102
100103 it ( 'shows inline token prompt when submitting without a token' , ( ) => {
101104 render ( < App /> ) ;
102105
103- fireEvent . input ( screen . getByLabelText ( 'Source URL' ) , {
106+ fireEvent . input ( screen . getByLabelText ( 'Page URL' ) , {
104107 target : { value : 'https://example.com/articles' } ,
105108 } ) ;
106109 fireEvent . click ( screen . getByRole ( 'button' , { name : 'Generate feed URL' } ) ) ;
@@ -110,11 +113,6 @@ describe('App', () => {
110113 } ) ;
111114
112115 it ( 'renders the result panel when a feed is available' , async ( ) => {
113- vi . spyOn ( window , 'fetch' ) . mockResolvedValue ( {
114- text : async ( ) =>
115- `<?xml version="1.0"?><rss><channel><title>Example Feed</title><item><title>Item One</title></item></channel></rss>` ,
116- } as Response ) ;
117-
118116 mockUseFeedConversion . mockReturnValue ( {
119117 isConverting : false ,
120118 result : {
@@ -132,13 +130,10 @@ describe('App', () => {
132130
133131 render ( < App /> ) ;
134132
135- expect ( screen . getByText ( 'Result ' ) ) . toBeInTheDocument ( ) ;
133+ expect ( screen . getByText ( 'Feed URL ready ' ) ) . toBeInTheDocument ( ) ;
136134 expect ( screen . getByRole ( 'button' , { name : 'Create another feed' } ) ) . toBeInTheDocument ( ) ;
137- expect ( screen . queryByText ( 'Run your own instance' ) ) . not . toBeInTheDocument ( ) ;
138-
139- await waitFor ( ( ) => {
140- expect ( screen . getByText ( 'Example Feed' ) ) . toBeInTheDocument ( ) ;
141- } ) ;
135+ expect ( screen . queryByRole ( 'link' , { name : 'Bookmarklet' } ) ) . not . toBeInTheDocument ( ) ;
136+ expect ( screen . getByText ( 'Example Feed' ) ) . toBeInTheDocument ( ) ;
142137 } ) ;
143138
144139 it ( 'surfaces conversion errors to the user' , ( ) => {
@@ -168,8 +163,7 @@ describe('App', () => {
168163
169164 render ( < App /> ) ;
170165
171- expect ( screen . getByText ( 'Utilities' ) ) . toBeInTheDocument ( ) ;
172- expect ( screen . queryByText ( 'Run your own instance' ) ) . not . toBeInTheDocument ( ) ;
166+ fireEvent . click ( screen . getByRole ( 'button' , { name : 'More' } ) ) ;
173167 fireEvent . click ( screen . getByRole ( 'button' , { name : 'Clear saved token' } ) ) ;
174168
175169 expect ( mockClearToken ) . toHaveBeenCalled ( ) ;
@@ -178,7 +172,7 @@ describe('App', () => {
178172 it ( 'saves access token and resumes feed creation from the inline prompt' , async ( ) => {
179173 render ( < App /> ) ;
180174
181- fireEvent . input ( screen . getByLabelText ( 'Source URL' ) , {
175+ fireEvent . input ( screen . getByLabelText ( 'Page URL' ) , {
182176 target : { value : 'https://example.com/articles' } ,
183177 } ) ;
184178 fireEvent . click ( screen . getByRole ( 'button' , { name : 'Generate feed URL' } ) ) ;
@@ -199,7 +193,7 @@ describe('App', () => {
199193 it ( 'submits the token prompt with Enter' , async ( ) => {
200194 render ( < App /> ) ;
201195
202- fireEvent . input ( screen . getByLabelText ( 'Source URL' ) , {
196+ fireEvent . input ( screen . getByLabelText ( 'Page URL' ) , {
203197 target : { value : 'https://example.com/articles' } ,
204198 } ) ;
205199 fireEvent . click ( screen . getByRole ( 'button' , { name : 'Generate feed URL' } ) ) ;
@@ -217,7 +211,8 @@ describe('App', () => {
217211 window . history . replaceState ( { } , '' , 'http://localhost:3000/frontend/index.html' ) ;
218212 render ( < App /> ) ;
219213
220- const bookmarklet = screen . getByRole ( 'link' , { name : 'Convert page to feed' } ) ;
214+ fireEvent . click ( screen . getByRole ( 'button' , { name : 'More' } ) ) ;
215+ const bookmarklet = screen . getByRole ( 'link' , { name : 'Bookmarklet' } ) ;
221216 expect ( bookmarklet . getAttribute ( 'href' ) ) . toContain ( '/frontend/index.html?url=' ) ;
222217 expect ( bookmarklet . getAttribute ( 'href' ) ) . not . toContain ( '%27+encodeURIComponent' ) ;
223218 } ) ;
0 commit comments