anbot

0431c76 / test/webui.sh

View file at this commit

diff --git a/test/webui.sh b/test/webui.sh
index bf3138a..2c33dd5 100755
--- a/test/webui.sh
+++ b/test/webui.sh
@@ -77,6 +77,12 @@ const submit = body => fetch(base + '/posts', {
 assert.equal((await submit(record)).status, 200)
 assert.equal((await submit(record.replace('Hello', 'Forged'))).status, 400)
 assert.equal((await submit(' '.repeat(32769))).status, 413)
+const original = JSON.parse(record)
+const raw = await fetch(base + '/raw?post=' + encodeURIComponent(original.id))
+assert.equal(raw.status, 200)
+assert.match(raw.headers.get('content-type'), /^application\/json/)
+assert.deepEqual(await raw.json(), original)
+assert.equal((await fetch(base + '/raw?post=invalid')).status, 404)
 JS
 if node "$cli" post --data "$scratch/node" --text '   ' >/dev/null 2>&1; then exit 1; fi
 if node "$cli" post --data "$scratch/node" --text 'Bad reply' --reply-to 'invalid' >/dev/null 2>&1; then exit 1; fi
@@ -206,6 +212,7 @@ assert.match(feed.text, /Hello &lt;script&gt;alert\(1\)&lt;\/script&gt;<br>\nSec
 assert.doesNotMatch(feed.text, /Blocked author|Forged/)
 assert.ok(feed.text.includes(`?author=${encodeURIComponent(author)}`))
 assert.ok(feed.text.includes(`?post=${encodeURIComponent(post)}`))
+assert.ok(feed.text.includes(`href="/raw?post=${encodeURIComponent(post)}">Raw`))
 assert.ok(feed.text.indexOf('Reply from another author') < feed.text.indexOf('Hello'))
 const ownFeed = await get(`/feed?author=${encodeURIComponent(author)}`)
 checkHtml(ownFeed, true)

Git ยท Social feed