Skip to content

Commit

Permalink
✅ Test archives
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernardstanislas committed Apr 5, 2023
1 parent 7035375 commit 65ff0cf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/routes/[month]/[day]/[year]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
}
</script>

<div>{$journal}</div>
<div data-testid="journal">{$journal}</div>
<a href="/">Back to today's journal</a>
15 changes: 12 additions & 3 deletions tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,19 @@ test("app stores journal's content", async ({ page }) => {
await expect(page.locator('img[alt="key avatar"]')).toBeVisible();

// Fill the journal and save it
await page.locator('textarea').fill(content);
await expect(page.locator('i')).toHaveText('Saved');
const status = page.getByTestId('status');
const journal = page.locator('textarea');
await expect(status).toHaveText('Saved');
await journal.type(content);
await expect(status).toHaveText('Not saved');
await expect(status).toHaveText('Saved');

// Check it was actually saved and restored
await page.reload();
await expect(page.locator('textarea')).toHaveValue(content);
await expect(journal).toHaveValue(content);

// Navigate to yersderday's journal
await expect(page.locator('a')).toHaveCount(2);
await page.locator('a').last().click();
await expect(page.getByTestId('journal')).toHaveText(content);
});

1 comment on commit 65ff0cf

@vercel
Copy link

@vercel vercel bot commented on 65ff0cf Apr 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.