Files
Fabric.Backend.Guild/src/messaging/pagination.util.spec.ts
hzhang 8c41d23a9c refactor: migrate to ES modules
package.json type=module, tsconfig module/moduleResolution=NodeNext,
target es2022, explicit .js on all relative imports. Center: jsonwebtoken
& bcryptjs switched to default imports (ESM/CJS interop). Verified:
builds, boots, full auth + plugin round-trip work under ESM.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 18:47:36 +01:00

16 lines
523 B
TypeScript

import { describe, expect, it } from 'vitest';
import { clampLimit, computeNextExpectedSeq } from './pagination.util.js';
describe('pagination utils', () => {
it('clamps limit safely', () => {
expect(clampLimit(undefined, 50, 200)).toBe(50);
expect(clampLimit('500', 50, 200)).toBe(200);
expect(clampLimit('-1', 50, 200)).toBe(50);
});
it('computes next expected seq', () => {
expect(computeNextExpectedSeq(1, [1, 2, 3])).toBe(4);
expect(computeNextExpectedSeq(1, [1, 3, 4])).toBe(2);
});
});