chore(history): squash 16 commit(s) from 2026-09-26
- chore(backend): sync Cargo.lock with gateway dev-dependency - feat(frontend): ClickGui replica matching the in-game GUI — category panels, Modules/Settings switch, theme cards - feat(frontend): floating glass top bar in the mod's UI language - fix(frontend): soft night backdrop for the ClickGui, editor that fits one screen - chore(frontend): replace em dashes in UI copy with lighter separators - refactor(frontend): split landing sections and theme editor into subfolders (4-files-per-folder rule) - feat(frontend): login and registration in the mod's glass panel style - feat(frontend): link the game with a device code - feat(frontend): account page with avatar upload and linked games - feat(frontend): my configs with share codes and publishing - feat(frontend): public showcase listing and detail pages - chore(frontend): drop em dashes from visible copy - feat(frontend): atmospheric backdrop, glass download block and ClickGui-style FAQ on the landing - feat(frontend): Konami code, DevTools console greeting and ASCII 404 block - feat: public player profiles at /u/:id and author link in the showcase - fix(frontend): stop the theme editor overflowing horizontally at 375px
This commit is contained in:
parent
7f4b532f99
commit
ff2edc8eb6
116 changed files with 3534 additions and 1020 deletions
33
frontend/src/features/account/tests/account.test.tsx
Normal file
33
frontend/src/features/account/tests/account.test.tsx
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { screen, within } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { expect, test } from 'vitest'
|
||||
import { checkAvatarFile } from '../api'
|
||||
import { DeviceList } from '../components/DeviceList'
|
||||
import { renderApp } from '../../../test/render'
|
||||
import { json, mockFetch } from '../../../test/fetch'
|
||||
|
||||
test('avatar file checks', () => {
|
||||
expect(checkAvatarFile(new File(['x'], 'a.gif', { type: 'image/gif' }))).toBe('Подойдёт PNG, JPG или WebP.')
|
||||
const big = new File([new Uint8Array(5 * 1024 * 1024 + 1)], 'a.png', { type: 'image/png' })
|
||||
expect(checkAvatarFile(big)).toBe('Файл больше 5 МБ.')
|
||||
expect(checkAvatarFile(new File(['x'], 'a.png', { type: 'image/png' }))).toBeUndefined()
|
||||
})
|
||||
|
||||
test('revoking a device asks for confirmation first', async () => {
|
||||
const user = userEvent.setup()
|
||||
let devices = [{ id: 'd1', linked_at: '2026-09-20T10:00:00Z', last_seen: null }]
|
||||
const fetch = mockFetch({
|
||||
'POST /auth/refresh': () => json({}, 401),
|
||||
'GET /device/links': () => json(devices),
|
||||
'DELETE /device/links/d1': () => {
|
||||
devices = []
|
||||
return new Response(null, { status: 204 })
|
||||
},
|
||||
})
|
||||
renderApp([{ path: '/', element: <DeviceList /> }])
|
||||
const row = await screen.findByRole('listitem')
|
||||
await user.click(within(row).getByRole('button', { name: 'Отвязать' }))
|
||||
expect(fetch.mock.calls.some(([, i]) => i?.method === 'DELETE')).toBe(false)
|
||||
await user.click(within(row).getByRole('button', { name: 'Точно отвязать?' }))
|
||||
expect(await screen.findByText(/Пока ни одной игры/)).toBeInTheDocument()
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue