mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-19 18:18:27 -05:00
refactor(client): daily challenges to use path params (#61776)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user