Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"eslint-plugin-testing-library": "^7.16.2",
"eslint-plugin-unicorn": "^64.0.0",
"eslint-plugin-unused-imports": "^4.4.1",
"jsdom": "29.1.0",
"jsdom": "29.1.1",
"knip": "^6.9.0",
"postcss": "^8.5.12",
"tailwindcss": "^4.2.4",
Expand Down
63 changes: 43 additions & 20 deletions frontend/src/pages/__tests__/UsersPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -522,20 +522,27 @@ describe('UsersPage', () => {
const user = userEvent.setup()
expect(await screen.findByText('Invite User')).toBeInTheDocument()
await user.click(screen.getByRole('button', { name: /Invite User/i }))
expect(await screen.findByPlaceholderText('user@example.com')).toBeInTheDocument()

const emailInput = screen.getByPlaceholderText('user@example.com')
await user.type(emailInput, 'test@example.com')
vi.useFakeTimers()

try {
const emailInput = screen.getByPlaceholderText('user@example.com')
fireEvent.change(emailInput, { target: { value: 'test@example.com' } })

await act(async () => {
await vi.advanceTimersByTimeAsync(550)
})

await waitFor(() => {
expect(client.post).toHaveBeenCalledWith('/users/preview-invite-url', { email: 'test@example.com' })
}, { timeout: 2000 })

await waitFor(() => {
const preview = screen.getByText('https://example.com/accept-invite?token=...')

expect(preview.textContent).toContain('...')
expect(preview.textContent).not.toContain('SAMPLE_TOKEN_PREVIEW')
}, { timeout: 2000 })
}
finally {
vi.useRealTimers()
}
})

it('shows warning when not configured', async () => {
Expand All @@ -556,18 +563,24 @@ describe('UsersPage', () => {
expect(await screen.findByText('Invite User')).toBeInTheDocument()
await user.click(screen.getByRole('button', { name: /Invite User/i }))

const emailInput = screen.getByPlaceholderText('user@example.com')
await user.type(emailInput, 'test@example.com')
vi.useFakeTimers()

try {
const emailInput = screen.getByPlaceholderText('user@example.com')
fireEvent.change(emailInput, { target: { value: 'test@example.com' } })

await act(async () => {
await vi.advanceTimersByTimeAsync(550)
})

await waitFor(() => {
expect(client.post).toHaveBeenCalledWith('/users/preview-invite-url', { email: 'test@example.com' })
}, { timeout: 2000 })

await waitFor(() => {
// Look for link to system settings
const link = screen.getByRole('link')
expect(link.getAttribute('href')).toContain('/settings/system')
}, { timeout: 2000 })
} finally {
vi.useRealTimers()
}
})

it('does not show preview when email is invalid', async () => {
Expand Down Expand Up @@ -599,17 +612,27 @@ describe('UsersPage', () => {
const user = userEvent.setup()
expect(await screen.findByText('Invite User')).toBeInTheDocument()
await user.click(screen.getByRole('button', { name: /Invite User/i }))
expect(await screen.findByPlaceholderText('user@example.com')).toBeInTheDocument()

const emailInput = screen.getByPlaceholderText('user@example.com')
await user.type(emailInput, 'test@example.com')
vi.useFakeTimers()

try {
const emailInput = screen.getByPlaceholderText('user@example.com')
fireEvent.change(emailInput, { target: { value: 'test@example.com' } })

await act(async () => {
await vi.advanceTimersByTimeAsync(550)
})

await waitFor(() => {
expect(client.post).toHaveBeenCalledWith('/users/preview-invite-url', { email: 'test@example.com' })
}, { timeout: 2000 })

// Verify preview is not displayed after error
const previewQuery = screen.queryByText(/accept-invite/)
expect(previewQuery).toBeNull()
// Verify preview is not displayed after error
const previewQuery = screen.queryByText(/accept-invite/)
expect(previewQuery).toBeNull()
}
finally {
vi.useRealTimers()
}
})
})

Expand Down
4 changes: 2 additions & 2 deletions lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ pre-commit:
# Remove overrides when plugins declare ESLint v10 support natively.
frontend-type-check:
glob: "frontend/**/*.{ts,tsx}"
run: cd frontend && npx tsc --noEmit
run: cd frontend && /usr/share/nodejs/corepack/shims/npx tsc --noEmit

frontend-lint:
glob: "frontend/**/*.{ts,tsx,js,jsx}"
run: cd frontend && npm run lint
run: cd frontend && /usr/share/nodejs/corepack/shims/npm run lint

semgrep:
glob: "{**/*.{go,ts,tsx,js,jsx,sh,yml,yaml,json},Dockerfile*}"
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"smol-toml": "^1.6.1"
},
"devDependencies": {
"@axe-core/playwright": "^4.11.2",
"@axe-core/playwright": "^4.11.3",
"@bgotink/playwright-coverage": "^0.3.2",
"@playwright/test": "^1.59.1",
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
Expand Down
Loading