Skip to content

Test your integration

Use a deterministic interpreter (a function that returns a fixed result) to test grid behavior without model credentials or network variability. This separates configuration and execution errors from model interpretation quality.

After these checks, test your real endpoint and authentication separately.

Test behavior independently of provider quality. A controller accepts a deterministic interpreter and an executor owned by your test:

import { expect, it } from 'vitest';
import { AiViewController, type AiViewSnapshot } from '@revolist/revogrid-pro';
it('applies an allowed sort', async () => {
let view: AiViewSnapshot = { sort: [] };
const controller = new AiViewController({
fields: [{
field: 'amount', label: 'Amount', valueType: 'number',
operators: [], sortable: true,
}],
interpret: async () => ({
kind: 'command',
sort: { mode: 'replace', items: [{ field: 'amount', direction: 'desc' }] },
}),
executor: {
read: () => view,
apply: async next => { view = next; },
},
});
await controller.submit('Sort by amount');
expect(view.sort).toEqual([{ field: 'amount', direction: 'desc' }]);
controller.destroy();
});

The reference suite also uses TanStack’s real tool engine with fakeText() and local HTTP tests, without live model calls. Run its lint and test scripts before changing server policy. Provider quality, live credentials and production deployment require separate verification.

Return to the AI Assistant overview to choose another guide.