Skip to content

Commit 818ddfa

Browse files
committed
test(browser): add integration test for project name encoding
- Replace unit test mock with a real browser integration test - Add fixture with project name containing an ampersand ('&')
1 parent 4c47fdc commit 818ddfa

4 files changed

Lines changed: 34 additions & 50 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { expect, test } from 'vitest'
2+
3+
test('basic test', () => {
4+
expect(true).toBe(true)
5+
})
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { defineConfig } from 'vitest/config'
2+
import { provider } from '../../settings'
3+
4+
export default defineConfig({
5+
test: {
6+
name: 'Components & Hooks',
7+
browser: {
8+
enabled: true,
9+
provider,
10+
instances: [{ browser: 'chromium' }],
11+
headless: true,
12+
},
13+
},
14+
})

test/browser/specs/client-url.test.ts

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { expect, test } from 'vitest'
2+
import { runBrowserTests } from './utils'
3+
4+
test('runs tests correctly when project name contains special characters', async () => {
5+
const { stderr, stdout, exitCode } = await runBrowserTests({
6+
root: 'test/browser/fixtures/project-name-encoding',
7+
})
8+
9+
// Prior to the fix, this would fail with a WebSocket connection error or similar
10+
expect(stderr).toBe('')
11+
expect(exitCode).toBe(0)
12+
expect(stdout).toContain('Test Files 1 passed')
13+
// Confirm the project name is correctly displayed (meaning it was parsed correctly)
14+
expect(stdout).toContain('Components & Hooks')
15+
})

0 commit comments

Comments
 (0)