import { describe, it, expect } from 'vitest';
import { TestConductor } from '@ensemble-edge/conductor/testing';
describe('fetch-pricing', () => {
it('should fetch pricing from API', async () => {
const conductor = await TestConductor.create({
mocks: {
http: {
responses: {
'https://api.example.com/pricing': {
status: 200,
data: {
plan: 'pro',
price: 99.99,
currency: 'USD'
}
}
}
}
}
});
const result = await conductor.executeMember('fetch-pricing', {
plan: 'pro'
});
expect(result).toBeSuccessful();
expect(result.output.status).toBe(200);
expect(result.output.data.price).toBe(99.99);
});
it('should handle API errors', async () => {
const conductor = await TestConductor.create({
mocks: {
http: {
handler: async () => {
throw new Error('API unavailable');
}
}
}
});
const result = await conductor.executeMember('fetch-pricing', {});
expect(result).toHaveError(/API unavailable/);
});
});