diff --git a/frontend/src/routes/(frontend)/[accountId]/index.tsx b/frontend/src/routes/(frontend)/[accountId]/index.tsx
index 1453fa0..c82c357 100644
--- a/frontend/src/routes/(frontend)/[accountId]/index.tsx
+++ b/frontend/src/routes/(frontend)/[accountId]/index.tsx
@@ -40,25 +40,23 @@ export default component$(() => {
const { accountId, statuses } = statusesLoader.use().value
return (
- <>
-
-
-
{
- let statuses: MastodonStatus[] = []
- try {
- const response = await fetch(
- `/api/v1/accounts/${accountId}/statuses?offset=${numOfCurrentStatuses}&with-replies=true`
- )
- if (response.ok) {
- const results = await response.text()
- statuses = JSON.parse(results)
- }
- } catch {
- /* empty */
+
+ {
+ let statuses: MastodonStatus[] = []
+ try {
+ const response = await fetch(
+ `/api/v1/accounts/${accountId}/statuses?offset=${numOfCurrentStatuses}&with-replies=true`
+ )
+ if (response.ok) {
+ const results = await response.text()
+ statuses = JSON.parse(results)
}
- return statuses
- })}
- />
-
+ } catch {
+ /* empty */
+ }
+ return statuses
+ })}
+ />
)
})
diff --git a/ui-e2e-tests/account-page.spec.ts b/ui-e2e-tests/account-page.spec.ts
index e0b9339..ffc3f5a 100644
--- a/ui-e2e-tests/account-page.spec.ts
+++ b/ui-e2e-tests/account-page.spec.ts
@@ -9,13 +9,11 @@ test(`Navigation via to and view of an account (with 1 post)`, async ({ page })
await expect(page.getByTestId('account-info').getByText('Joined')).toBeVisible()
await expect(page.getByTestId('account-info').getByTestId('stats')).toHaveText('1Posts0Following0Followers')
- expect(await page.getByTestId('account-statuses').getByRole('article').count()).toBe(1)
+ expect(await page.getByTestId('account-posts').getByRole('article').count()).toBe(1)
await expect(
- page.getByTestId('account-statuses').getByRole('article').getByRole('img', { name: 'Avatar of Ben, just Ben' })
+ page.getByTestId('account-posts').getByRole('article').getByRole('img', { name: 'Avatar of Ben, just Ben' })
).toBeVisible()
- await expect(page.getByTestId('account-statuses').getByRole('article')).toContainText(
- 'A very simple update: all good!'
- )
+ await expect(page.getByTestId('account-posts').getByRole('article')).toContainText('A very simple update: all good!')
})
test('Navigation to and view of an account (with 2 posts)', async ({ page }) => {
@@ -28,10 +26,30 @@ test('Navigation to and view of an account (with 2 posts)', async ({ page }) =>
await expect(page.getByTestId('account-info').getByText('Joined')).toBeVisible()
await expect(page.getByTestId('account-info').getByTestId('stats')).toHaveText('2Posts0Following0Followers')
- expect(await page.getByTestId('account-statuses').getByRole('article').count()).toBe(2)
- const [post1Locator, post2Locator] = await page.getByTestId('account-statuses').getByRole('article').all()
+ expect(await page.getByTestId('account-posts').getByRole('article').count()).toBe(2)
+ const [post1Locator, post2Locator] = await page.getByTestId('account-posts').getByRole('article').all()
await expect(post1Locator.getByRole('img', { name: 'Avatar of Raffa123$' })).toBeVisible()
await expect(post1Locator).toContainText("I'm Rafael and I am a web designer")
await expect(post2Locator.getByRole('img', { name: 'Avatar of Raffa123$' })).toBeVisible()
await expect(post2Locator).toContainText('Hi! My name is Rafael!')
})
+
+test('View of an account with only a reply and 0 posts', async ({ page }) => {
+ await page.goto('http://127.0.0.1:8788/@Penny')
+
+ await expect(page.getByTestId('account-posts')).toBeVisible()
+ await expect(page.getByTestId('account-posts')).toHaveText('Nothing to see right now. Check back later!')
+ await expect(page.getByTestId('account-posts-and-replies')).not.toBeVisible()
+
+ await page.getByRole('link', { name: 'Posts and replies' }).click()
+
+ await expect(page.getByTestId('account-posts-and-replies')).toBeVisible()
+ await expect(page.getByTestId('account-posts-and-replies').getByRole('article')).toContainText('Yes you guys did it!')
+ await expect(page.getByTestId('account-posts')).not.toBeVisible()
+
+ await page.getByRole('link', { name: 'Posts', exact: true }).click()
+
+ await expect(page.getByTestId('account-posts')).toBeVisible()
+ await expect(page.getByTestId('account-posts')).toHaveText('Nothing to see right now. Check back later!')
+ await expect(page.getByTestId('account-posts-and-replies')).not.toBeVisible()
+})