-
Notifications
You must be signed in to change notification settings - Fork 7
fix: Update Typescript testing rules and skills #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
3a8d9d4
09ed327
206092b
ef3985b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -26,49 +26,85 @@ tests/ | |||||||||||||||||||||||||||||||||
| ├── fixtures/ | ||||||||||||||||||||||||||||||||||
| │ ├── auth.ts | ||||||||||||||||||||||||||||||||||
| │ └── data.ts | ||||||||||||||||||||||||||||||||||
| ├── pageObjects/ | ||||||||||||||||||||||||||||||||||
| │ └── components/ | ||||||||||||||||||||||||||||||||||
| │ │ └── base.component.ts | ||||||||||||||||||||||||||||||||||
| │ │ └── header.component.ts | ||||||||||||||||||||||||||||||||||
| │ └── pages/ | ||||||||||||||||||||||||||||||||||
| │ └── base.page.ts | ||||||||||||||||||||||||||||||||||
| │ └── items.page.ts | ||||||||||||||||||||||||||||||||||
| ├── types/ | ||||||||||||||||||||||||||||||||||
| │ └── searchData.ts | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| │ └── components/ | |
| │ │ └── base.component.ts | |
| │ │ └── header.component.ts | |
| │ └── pages/ | |
| │ └── base.page.ts | |
| │ └── items.page.ts | |
| ├── types/ | |
| │ └── searchData.ts | |
| │ ├── components/ | |
| │ │ ├── base.component.ts | |
| │ │ └── header.component.ts | |
| │ └── pages/ | |
| │ ├── base.page.ts | |
| │ └── items.page.ts | |
| ├── types/ | |
| │ ├── searchData.ts |
Copilot
AI
Apr 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This snippet imports expect but doesn't use it anywhere in the page-object example. Since this is presented as copy/pasteable TypeScript, it will trigger unused-import lint/TS warnings; remove expect from the import (or use it in a test snippet instead).
| import { expect, Locator, Page } from '@playwright/test' | |
| import { Locator, Page } from '@playwright/test' |
Copilot
AI
Apr 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Within this TypeScript snippet, most lines omit semicolons, but the added waitFor(...) line ends with a semicolon. For consistency (and to avoid mixed-style examples), consider removing the semicolon here and in similar added examples in this doc.
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -76,19 +76,19 @@ For each user journey, create comprehensive test cases: | |||||||||||||
|
|
||||||||||||||
| ```typescript | ||||||||||||||
| describe('Semantic Search', () => { | ||||||||||||||
| it('returns relevant markets for query', async () => { | ||||||||||||||
| it('should return relevant markets for query', async () => { | ||||||||||||||
| // Test implementation | ||||||||||||||
| }) | ||||||||||||||
|
|
||||||||||||||
| it('handles empty query gracefully', async () => { | ||||||||||||||
| it('should handle empty query gracefully', async () => { | ||||||||||||||
| // Test edge case | ||||||||||||||
| }) | ||||||||||||||
|
|
||||||||||||||
| it('falls back to substring search when Redis unavailable', async () => { | ||||||||||||||
| it('should fall back to substring search when Redis unavailable', async () => { | ||||||||||||||
| // Test fallback behavior | ||||||||||||||
| }) | ||||||||||||||
|
|
||||||||||||||
| it('sorts results by similarity score', async () => { | ||||||||||||||
| it('should sort results by similarity score', async () => { | ||||||||||||||
| // Test sorting logic | ||||||||||||||
| }) | ||||||||||||||
| }) | ||||||||||||||
|
|
@@ -177,12 +177,12 @@ import { render, screen, fireEvent } from '@testing-library/react' | |||||||||||||
| import { Button } from './Button' | ||||||||||||||
|
|
||||||||||||||
| describe('Button Component', () => { | ||||||||||||||
| it('renders with correct text', () => { | ||||||||||||||
| it('should render the button with correct text', () => { | ||||||||||||||
| render(<Button>Click me</Button>) | ||||||||||||||
| expect(screen.getByText('Click me')).toBeInTheDocument() | ||||||||||||||
| }) | ||||||||||||||
|
|
||||||||||||||
| it('calls onClick when clicked', () => { | ||||||||||||||
| it('should call onClick when clicked', () => { | ||||||||||||||
| const handleClick = jest.fn() | ||||||||||||||
| render(<Button onClick={handleClick}>Click</Button>) | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -191,7 +191,7 @@ describe('Button Component', () => { | |||||||||||||
| expect(handleClick).toHaveBeenCalledTimes(1) | ||||||||||||||
| }) | ||||||||||||||
|
|
||||||||||||||
| it('is disabled when disabled prop is true', () => { | ||||||||||||||
| it('should disable the button when disabled prop is true', () => { | ||||||||||||||
| render(<Button disabled>Click</Button>) | ||||||||||||||
| expect(screen.getByRole('button')).toBeDisabled() | ||||||||||||||
| }) | ||||||||||||||
|
|
@@ -233,46 +233,46 @@ describe('GET /api/markets', () => { | |||||||||||||
| ```typescript | ||||||||||||||
| import { test, expect } from '@playwright/test' | ||||||||||||||
|
|
||||||||||||||
| test('user can search and filter markets', async ({ page }) => { | ||||||||||||||
| test('should let user search and filter markets', async ({ page }) => { | ||||||||||||||
| // Navigate to markets page | ||||||||||||||
| await page.goto('/') | ||||||||||||||
| await page.click('a[href="/markets"]') | ||||||||||||||
| await page.locator('a[href="/markets"]').click() | ||||||||||||||
|
|
||||||||||||||
| // Verify page loaded | ||||||||||||||
| await expect(page.locator('h1')).toContainText('Markets') | ||||||||||||||
|
|
||||||||||||||
| // Search for markets | ||||||||||||||
| await page.fill('input[placeholder="Search markets"]', 'election') | ||||||||||||||
| await page.locator('input[placeholder="Search markets"]').fill('election') | ||||||||||||||
|
|
||||||||||||||
| // Wait for debounce and results | ||||||||||||||
| await page.waitForTimeout(600) | ||||||||||||||
| // Wait for the filtered result set to settle | ||||||||||||||
| const results = page.locator('[data-testid="market-card"]') | ||||||||||||||
| await results.first().waitFor({ state: 'visible', timeout: 5000 }); | ||||||||||||||
|
||||||||||||||
| // Wait for the filtered result set to settle | |
| const results = page.locator('[data-testid="market-card"]') | |
| await results.first().waitFor({ state: 'visible', timeout: 5000 }); | |
| // Wait for the filtered result set to settle | |
| const results = page.locator('[data-testid="market-card"]') | |
| await results.first().waitFor({ state: 'visible', timeout: 5000 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The directory tree diagram under
pageObjects/has inconsistent indentation and uses└──for multiple sibling entries (e.g., bothbase.component.tsandheader.component.ts). This makes the structure ambiguous; update the tree markers/indentation so siblings use├──/└──correctly.