agnostic-query
Version:
Type-safe fluent builder for portable query schemas. Runtime-agnostic, database-agnostic — the same QuerySchema drives Drizzle, Kysely, db0, or raw SQL.
22 lines (18 loc) • 629 B
text/typescript
import { describe, expect, it } from 'bun:test';
import { fromTanDbOrderBy } from './tanstack-db.ts';
import type { QueryOrderBy } from './core/order-by.ts';
type UserShape = { id: string; name: string; age: number; role: string };
describe('fromTanDbOrderBy', () => {
it('null returns empty array', () => {
expect(fromTanDbOrderBy(null)).toEqual([]);
});
});
describe('QueryOrderBy type', () => {
it('accepts valid order by array', () => {
const ob: QueryOrderBy<UserShape>[] = [
{ field: ['name'], direction: 'asc' },
{ field: ['age'], direction: 'desc' },
];
expect(Array.isArray(ob)).toBe(true);
});
});