ponder-client
Version:
Type-safe, lightweight Ponder client
28 lines • 803 B
JavaScript
import { createSchema } from '@ponder/core';
import { assertType, describe, it, expectTypeOf } from 'vitest';
import { one } from './index.js';
const schema = createSchema((p) => ({
Item: p.createTable({
id: p.string(),
address: p.hex(),
chainId: p.int(),
factory: p.hex(),
values: p.hex().list(),
}),
}));
describe('one', () => {
it('should return a function', () => {
const queryPart = one('Item')({
id: '80001-0x0011a9df49622ab6c8c7ca24f44c3c5c3f4228e8',
}, {
id: true,
address: true,
chainId: true,
});
expectTypeOf(queryPart);
assertType(
// @ts-expect-error "Invalid table name"
queryPart);
});
});
//# sourceMappingURL=index.test.js.map