Files
windmill/frontend/src/lib/components/auditLogs/useAuditLogsLoader.test.ts
T
9334727d99 feat: stream audit logs in batches when a page is slow to load (#10695)
* feat: stream audit logs in batches when a page is slow to load

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: bound streamed page size and clear stale rows on stop

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: keep the runs batch cap and drop rows of a replaced query on failure

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: ignore stop once a load has settled and reset paging when one fails

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* chore: update ee-repo-ref to aab7da6e1f8b1fadacc2208913a5d6596f06f922

This commit updates the EE repository reference after PR #727 was merged in windmill-ee-private.

Previous ee-repo-ref: 59ba8d7ce9ce1de0814b159b3813c2ac2a49239a

New ee-repo-ref: aab7da6e1f8b1fadacc2208913a5d6596f06f922

Automated by sync-ee-ref workflow.

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
2026-08-14 13:31:26 +02:00

20 lines
871 B
TypeScript

import { describe, expect, it } from 'vitest'
import { computeFirstBatch } from './useAuditLogsLoader.svelte'
describe('computeFirstBatch', () => {
it('starts at the page itself when nothing is batched', () => {
expect(computeFirstBatch(3, 100, 100)).toEqual({ firstPage: 3, skipFirst: 0 })
})
it('lands exactly on the page start when the batch size divides the offset', () => {
expect(computeFirstBatch(1, 100, 25)).toEqual({ firstPage: 1, skipFirst: 0 })
expect(computeFirstBatch(3, 100, 25)).toEqual({ firstPage: 9, skipFirst: 0 })
expect(computeFirstBatch(2, 100, 1)).toEqual({ firstPage: 101, skipFirst: 0 })
})
it('drops the rows before the page start when it does not', () => {
// page 2 of 100 starts at offset 100, batches of 30 can only land on offset 90
expect(computeFirstBatch(2, 100, 30)).toEqual({ firstPage: 4, skipFirst: 10 })
})
})