From 2671d13489d02430ab10113f063a9e14dbbb15b4 Mon Sep 17 00:00:00 2001 From: rays Date: Sun, 15 Nov 2026 00:51:04 +0000 Subject: [PATCH] Browser suite: ipxd list, a feed that moves for good, Atom with a bare ampersand (#463) API coverage 78.0% to 80.0% (9174 of 11467 lines): follow_move and the catalogue's list, and the parser's retry of an escaped Atom feed. Co-Authored-By: Claude Opus 5.5 --- tests/ui/app.spec.ts | 14 +++++++++++--- tests/ui/fixtures/serve.ts | 8 ++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/ui/app.spec.ts b/tests/ui/app.spec.ts index 5156440..d9a9796 100644 --- a/tests/ui/app.spec.ts +++ b/tests/ui/app.spec.ts @@ -702,10 +702,12 @@ test('a feed that starts failing says why, and after a day in words with somethi await expect(page.locator('#content [data-ffail="newurl"]')).toBeVisible(); } } - // Back again: the error goes, and so does the banner. - await flip('ok'); + // Back again, from the address it moved to for good: the error goes, and the feed is read + // from there from now on. + await flip('moved'); await page.request.post('/api/fetch', { data: { feed: id, force: true } }); await expect.poll(async () => (await feed()).last_error, { timeout: 20_000 }).toBeNull(); + await expect.poll(async () => (await feed()).url, { timeout: 20_000 }).toBe(`${F}/moved.xml`); } finally { await flip('ok'); await page.request.delete(`/api/feeds/${encodeURIComponent(id)}`); @@ -1133,8 +1135,9 @@ test('ipxd user adds, lists, renames and removes accounts, and says what is wron fs.rmSync(dir, { recursive: true, force: true }); fs.mkdirSync(path.join(dir, 'data'), { recursive: true }); fs.writeFileSync(path.join(dir, 'config.toml'), - `[general]\ndownload_dir = "${dir}/downloads"\nsocket = "${dir}/ipx.sock"\n`); + `[general]\ndownload_dir = "${dir}/downloads"\nsocket = "${dir}/ipx.sock"\nfetch_internal = ["127.0.0.1"]\n`); const env = { ...process.env, IPX_CONFIG: path.join(dir, 'config.toml'), IPX_DATA_DIR: path.join(dir, 'data') }; + const cli = (args: string[]) => execFileSync(setup.IPX_BIN, args, { env, encoding: 'utf8' }); const ipx = (args: string[], input = '') => execFileSync(setup.IPX_BIN, ['user', ...args], { env, input, encoding: 'utf8' }); const fails = (args: string[], input = '') => { try { ipx(args, input); } catch (e) { return said(e); } throw new Error(`${args} succeeded`); }; @@ -1156,6 +1159,11 @@ test('ipxd user adds, lists, renames and removes accounts, and says what is wron expect(ipx(['rm', 'bea'])).toBe('removed bea\n'); expect(fails(['rm', 'bea'])).toContain('no such account: bea'); expect(ipx(['list'])).not.toContain('bea'); + + // ipxd list: the feeds, each with its id on a line of its own. + expect(cli(['list'])).toContain('No feeds configured'); + cli(['add', 'http://127.0.0.1:8792/cli.xml']); + expect(cli(['list'])).toMatch(/^ {4}id {11}\S+\n {4}url {10}http:\/\/127\.0\.0\.1:8792\/cli\.xml\n {4}last checked never$/m); }); test('ipxd import subscribes the admin, and ipxd export writes the feeds out', async () => { diff --git a/tests/ui/fixtures/serve.ts b/tests/ui/fixtures/serve.ts index d00a421..382ef76 100644 --- a/tests/ui/fixtures/serve.ts +++ b/tests/ui/fixtures/serve.ts @@ -89,7 +89,7 @@ http.createServer((req, res) => { next(); return; } - // Feeds in the shapes the others are not (#463): Atom; RSS with a bare "&" and the iTunes and + // Feeds in the shapes the others are not (#463): Atom and RSS each with a bare "&", the RSS with the iTunes and // Media RSS fields; WordPress.com's posts as its API sends them; and replies that are no feed. const at = `http://127.0.0.1:${port}`; const shapes: Record = { @@ -97,7 +97,7 @@ http.createServer((req, res) => { Atom’s Show An Atom feed${at}/art.jpg urn:atom-show2026-01-01T00:00:00Z -urn:atom-1Q&A in Atom2026-01-02T00:00:00Z +urn:atom-1Q&A in Atom2026-01-02T00:00:00Z 2026-01-02T00:00:00Z @@ -121,6 +121,9 @@ http.createServer((req, res) => { guid: { rendered: `${at}/?p=1` }, link: `${at}/wp-1`, title: { rendered: 'WordPress “post”' }, date_gmt: '2026-01-04T12:00:00', content: { rendered: '

Post body

' }, jetpack_featured_media_url: `${at}/art.jpg`, }])], + // Where /flip.xml moves to for good. + '/moved.xml': ['application/rss+xml', `Flip Show +flip-1Flip one`], '/said.txt': ['text/plain', 'Unable to establish a DB connection'], '/long.txt': ['text/plain', 'This site is down for maintenance and will be back shortly, thank you for your patience while we work'], '/empty.xml': ['application/xml', ''], @@ -132,6 +135,7 @@ http.createServer((req, res) => { if (req.url?.startsWith('/flip?to=')) { flip = req.url.slice('/flip?to='.length); res.writeHead(204).end(); return; } if (req.url === '/flip.xml') { if (/^\d{3}$/.test(flip)) { res.writeHead(Number(flip)).end('no'); return; } + if (flip === 'moved') { res.writeHead(301, { location: '/moved.xml' }).end(); return; } if (flip === 'loop') { res.writeHead(302, { location: '/flip.xml' }).end(); return; } if (flip === 'drop') { req.socket.destroy(); return; } const body = flip === 'text' ? 'Unable to establish a DB connection'