CI and images / lint (push) Successful in 2s
CI and images / extension-version (push) Successful in 2s
CI and images / frontend-build (push) Successful in 20s
CI and images / backend-lint-and-test (push) Successful in 30s
CI and images / integration (push) Successful in 2m18s
CI and images / sign-extension (push) Successful in 3s
CI and images / build-agent (push) Successful in 6s
CI and images / build-web (push) Successful in 1m44s
CI and images / smoke-web (push) Successful in 56s
CI and images / promote (push) Skipped
tests/factories.py holds image_row/make_image/make_image_async/make_tag. The 17 byte-identical _img/_tag helpers (15 modules) now import them under their old names, so no call site changed. frontend/test/support/stubFetch.js replaces 15 copies that differed only in formatting. Copies whose bodies differ (other defaults, other columns, a url-only stub) are left as they are; folding those needs a look at each caller. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LVjrnpQjRgHdvq95rASoiR
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'
|
|
import { setActivePinia, createPinia } from 'pinia'
|
|
import { useDbMaintenanceStore } from '../src/stores/dbMaintenance.js'
|
|
import { stubFetch } from './support/stubFetch.js'
|
|
|
|
describe('dbMaintenance store', () => {
|
|
beforeEach(() => setActivePinia(createPinia()))
|
|
afterEach(() => vi.restoreAllMocks())
|
|
|
|
it('loadStats populates the bloat table', async () => {
|
|
const s = useDbMaintenanceStore()
|
|
stubFetch(() => ({
|
|
status: 200,
|
|
body: { tables: [{ table: 'image_record', live: 5, dead: 1, dead_pct: 16.7, last_vacuum: null }] },
|
|
}))
|
|
await s.loadStats()
|
|
expect(s.tables).toHaveLength(1)
|
|
expect(s.tables[0].table).toBe('image_record')
|
|
})
|
|
|
|
it('runVacuum POSTs the trigger endpoint', async () => {
|
|
const s = useDbMaintenanceStore()
|
|
const calls = []
|
|
stubFetch((url, init) => {
|
|
calls.push({ url, init })
|
|
return { status: 202, body: { status: 'queued' } }
|
|
})
|
|
await s.runVacuum()
|
|
const c = calls.at(-1)
|
|
expect(c.url).toContain('/api/admin/maintenance/vacuum')
|
|
expect(c.init.method).toBe('POST')
|
|
})
|
|
})
|