import { describe, it, expect } from 'vitest';
describe('Foundation contracts', () => {
    describe('UseCase', () => {
        it('should allow sync implementation', () => {
            const useCase = {
                execute: (input) => input.length
            };
            expect(useCase.execute('test')).toBe(4);
        });
        it('should allow async implementation', async () => {
            const useCase = {
                execute: async (input) => input.length
            };
            expect(await useCase.execute('test')).toBe(4);
        });
    });
    describe('Presenter', () => {
        it('should transform domain to view model', () => {
            const presenter = {
                present: (data) => ({ displayName: data.name.toUpperCase() })
            };
            expect(presenter.present({ name: 'john' })).toEqual({ displayName: 'JOHN' });
        });
    });
    describe('Gateway', () => {
        it('should define CRUD operations', async () => {
            const store = new Map();
            const gateway = {
                getById: async (id) => store.get(id),
                save: async (entity) => { store.set(entity.id, entity); }
            };
            await gateway.save({ id: '1' });
            expect(await gateway.getById('1')).toEqual({ id: '1' });
        });
    });
    describe('ReadOnlyGateway', () => {
        it('should define read operations only', async () => {
            const gateway = {
                getById: async () => ({ id: '1' }),
                getAll: async () => [{ id: '1' }, { id: '2' }]
            };
            expect(await gateway.getAll()).toHaveLength(2);
        });
    });
});
//# sourceMappingURL=foundation.contracts.test.js.map