// tests/smoke.test.ts
import { describe, it, expect, vi } from 'vitest';
import { run } from '../src/index';
import type { SkillContext } from '@glideco/schemas';
const mockCtx: SkillContext = {
rpc: vi.fn().mockResolvedValue({
transactions: [
{ txId: 'tx_001', amountUsdc: '50.00', timestamp: '2026-05-01T10:00:00Z' },
{ txId: 'tx_002', amountUsdc: '120.00', timestamp: '2026-05-02T14:30:00Z' },
],
}),
storage: {
uploadCsv: vi.fn().mockResolvedValue('https://storage.glide.co/exports/demo.csv'),
},
consentAnswers: { 'data-retention': '24h' },
};
describe('spend-export smoke', () => {
it('returns correct row count and total', async () => {
const result = await run(
{
accountId: 'acc_demo_01',
from: '2026-05-01T00:00:00Z',
to: '2026-05-03T00:00:00Z',
format: 'csv',
},
mockCtx,
);
expect(result.rowCount).toBe(2);
expect(result.totalUsdc).toBe('170.00');
expect(result.exportUrl).toMatch(/^https:\/\//);
});
});