feat: sites and authors integration into existing screens (& formated all frontend files kinda accidentally)

This commit is contained in:
Florian Sylvain committed 2026-10-15 05:25:44 +02:00
1 parent 3d81d2c717
commit 6b8990c55e
239 files changed
+9194 -1354

No files matched your search

@@ -41,7 +41,11 @@ vi.mock('@/composables/useApi', async (importOriginal) => {
return { ...actual, useApi: vi.fn() }
})
const toasts = vi.hoisted(() => ({ add: vi.fn(), remove: vi.fn(), update: vi.fn() }))
const toasts = vi.hoisted(() => ({
add: vi.fn(),
remove: vi.fn(),
update: vi.fn(),
}))
vi.mock('@nuxt/ui/composables', async (importOriginal) => {
const actual = await importOriginal<typeof import('@nuxt/ui/composables')>()
@@ -284,7 +288,9 @@ describe('Purge dialog: leaving', () => {
expect(dialogEl()).toBeNull()
await vi.waitFor(() => expect(router.currentRoute.value.path).toBe('/media'))
expect(router.currentRoute.value.query).toEqual({ filter: 'duplicates' })
expect(router.currentRoute.value.query).toEqual({
filter: 'duplicates',
})
})
})
@@ -313,9 +319,12 @@ describe('Purge dialog: purging', () => {
await vi.waitFor(() => expect(confirm.querySelector('svg.iconify--lucide')).toBeTruthy())
expect(findButton('Cancel', dialogEl()!)!.disabled).toBe(true)
pressEscape(dialogEl())
document.body
.querySelector('[data-slot="overlay"]')
?.dispatchEvent(new MouseEvent('pointerdown', { bubbles: true, cancelable: true }))
document.body.querySelector('[data-slot="overlay"]')?.dispatchEvent(
new MouseEvent('pointerdown', {
bubbles: true,
cancelable: true,
}),
)
await flushPromises()
expect(dialogEl()).not.toBeNull()
@@ -325,7 +334,9 @@ describe('Purge dialog: purging', () => {
})
it('closes, shows the toast, refreshes Last purge in place and returns focus on success', async () => {
const opener = await opened({ settings: afterRefresh(purgedSettings()) })
const opener = await opened({
settings: afterRefresh(purgedSettings()),
})
expect(lastLine()).toBe(LAST_RUN_LINE)
confirmButton('Purge 4 groups').click()
@@ -351,7 +362,10 @@ describe('Purge dialog: purging', () => {
it('shows no Next purge when automatic purge is off', async () => {
await opened({
settings: afterRefresh(
purgedSettings({ auto_purge_enabled: false, next_purge_at: null }),
purgedSettings({
auto_purge_enabled: false,
next_purge_at: null,
}),
),
})
@@ -363,13 +377,17 @@ describe('Purge dialog: purging', () => {
})
it('pluralises the toast', async () => {
await opened({ purge: () => purgeResult({ merged: 1, articles_updated: 1 }) })
await opened({
purge: () => purgeResult({ merged: 1, articles_updated: 1 }),
})
confirmButton('Purge 4 groups').click()
await flushPromises()
expect(toasts.add).toHaveBeenCalledWith(
expect.objectContaining({ description: '1 copy merged. 1 article updated.' }),
expect.objectContaining({
description: '1 copy merged. 1 article updated.',
}),
)
})
@@ -402,7 +420,10 @@ describe('Purge dialog: failures', () => {
])(
'keeps the dialog open after %s and retries with the same fingerprint',
async (_name, purge) => {
await opened({ preview: () => previewOf({ fingerprint: 'ab12' }), purge })
await opened({
preview: () => previewOf({ fingerprint: 'ab12' }),
purge,
})
confirmButton('Purge 4 groups').click()
await flushPromises()
@@ -513,11 +534,15 @@ describe('Purge dialog: failures', () => {
confirmButton('Purge 3 groups').click()
await flushPromises()
expect(bodyOf(callsTo('POST', PURGE_PATH)[1]!)).toEqual({ fingerprint: 'cd34' })
expect(bodyOf(callsTo('POST', PURGE_PATH)[1]!)).toEqual({
fingerprint: 'cd34',
})
})
it('shows the server text when a purge is already running', async () => {
await opened({ purge: () => Promise.reject(new ApiError(409, undefined, BUSY_COPY)) })
await opened({
purge: () => Promise.reject(new ApiError(409, undefined, BUSY_COPY)),
})
confirmButton('Purge 4 groups').click()
await flushPromises()