refactor(client): daily challenges to use path params (#61776)

This commit is contained in:
Tom
2025-08-12 01:39:52 -05:00
committed by GitHub
parent 8405f24a40
commit 7634b5c8a1
14 changed files with 114 additions and 53 deletions

View File

@@ -66,7 +66,7 @@ const mockDaysInMonth = new Date(year, month, 0).getDate();
test.describe('Daily Coding Challenges', () => {
test('should show not found page for invalid date', async ({ page }) => {
await page.goto('/learn/daily-coding-challenge?date=invalid-date');
await page.goto('/learn/daily-coding-challenge/invalid-date');
await expect(
page.getByText(/daily coding challenge not found\./i)
).toBeVisible();
@@ -83,7 +83,7 @@ test.describe('Daily Coding Challenges', () => {
});
});
await page.goto('/learn/daily-coding-challenge?date=2025-01-01');
await page.goto('/learn/daily-coding-challenge/2025-01-01');
await expect(
page.getByText(/daily coding challenge not found\./i)
).toBeVisible();
@@ -98,7 +98,7 @@ test.describe('Daily Coding Challenges', () => {
});
});
await page.goto('/learn/daily-coding-challenge?date=2025-01-01');
await page.goto('/learn/daily-coding-challenge/2025-01-01');
await expect(
page.getByText(/daily coding challenge not found\./i)
).toBeVisible();
@@ -115,7 +115,7 @@ test.describe('Daily Coding Challenges', () => {
});
});
await page.goto('/learn/daily-coding-challenge?date=2025-06-27');
await page.goto('/learn/daily-coding-challenge/2025-06-27');
await expect(
page.getByText(/daily coding challenge not found\./i)
).toBeVisible();
@@ -132,7 +132,7 @@ test.describe('Daily Coding Challenges', () => {
});
});
await page.goto(`/learn/daily-coding-challenge?date=${todayUsCentral}`);
await page.goto(`/learn/daily-coding-challenge/${todayUsCentral}`);
await expect(page.getByText('Test title')).toBeVisible();
@@ -171,14 +171,35 @@ test.describe('Daily Coding Challenges', () => {
'# Python seed code'
);
await page.goto(`/learn/daily-coding-challenge?date=${todayUsCentral}`);
await page.goto(`/learn/daily-coding-challenge/${todayUsCentral}`);
await expect(page.getByRole('button', { name: /main.py/i })).toBeVisible();
});
});
test.describe('Daily Coding Challenge Archive', () => {
test('should load and display the calendar', async ({ page }) => {
test('/learn/daily-coding-challenge should redirect to archive', async ({
page
}) => {
await page.goto('/learn/daily-coding-challenge');
await expect(page).toHaveURL('/learn/daily-coding-challenge/archive');
});
test('/learn/daily-coding-challenge/ should redirect to archive', async ({
page
}) => {
await page.goto('/learn/daily-coding-challenge/');
await expect(page).toHaveURL('/learn/daily-coding-challenge/archive');
});
test('/learn/daily-coding-challenge/path-1/path2 should redirect to archive', async ({
page
}) => {
await page.goto('/learn/daily-coding-challenge/path-1/path2');
await expect(page).toHaveURL('/learn/daily-coding-challenge/archive');
});
test('archive should load and display the calendar', async ({ page }) => {
await page.route(allRouteRe, async route => {
await route.fulfill({
status: 200,