Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/__tests__/participant-moderation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const media = {
const participant = (username, extra = {}) => ({
username, state: 'playing', media, time: 10000, updatedAt: Date.now(), playbackRate: 1, duration: 60000, ...extra,
});
const setup = () => {
const setup = (friendOptions = {}) => {
const kick = vi.fn().mockResolvedValue();
const transfer = vi.fn().mockResolvedValue();
const store = createStore({
Expand All @@ -32,7 +32,7 @@ const setup = () => {
host: 'me',
users: {
me: participant('Host viewer'),
friend: participant('Morgan with a long display name'),
friend: participant('Morgan with a long display name', friendOptions),
buffering: participant('Sam', { state: 'buffering' }),
different: participant('Taylor', { media: { ...media, title: 'Another movie', ratingKey: '2' } }),
stopped: participant('Alex', { state: 'stopped', media: null }),
Expand Down Expand Up @@ -78,6 +78,15 @@ describe('participant actions and readable status', () => {
wrapper.unmount();
}
});
it.each([[3000, 'In sync'], [500, 'Catching up']])('renders readiness with tolerance %s', (tolerance, label) => {
const { wrapper } = setup({ time: 8000, syncFlexibility: tolerance });
try {
const row = wrapper.findAll('.v-list-item').find((item) => item.text().includes('Morgan'));
expect(row.text()).toContain(label);
} finally {
wrapper.unmount();
}
});
const moderationCases = [['Remove from room', 'kick'], ['Make host', 'transfer']];
it.each(moderationCases)('requires named confirmation for %s', async (label, action) => {
const { wrapper, kick, transfer } = setup();
Expand Down
Loading