import { describe, it, expect } from 'vitest';
import { render } from '@testing-library/react';
import { AvatarStack } from '../AvatarStack';
const people = ['Anna', 'Ben', 'Carla', 'Dana', 'Emil'].map((name, i) => ({ id: `u${i}`, name }));
describe('AvatarStack (who a list or note is shared with)', () => {
it('shows at most three people and the rest as +n', () => {
const { container } = render();
expect(container.textContent).toContain('+2');
expect(container.firstElementChild?.children.length).toBe(4); // 3 avatars + overflow circle
});
it('renders nothing for an unshared item', () => {
expect(render().container.firstChild).toBeNull();
});
it('needs no overflow circle when everyone fits', () => {
const { container } = render();
expect(container.textContent).not.toContain('+');
});
});