import { describe, expect, it } from 'vitest' import { queryKeysForListEvent } from './list-events' describe('queryKeysForListEvent', () => { it('refreshes only the item list for item events', () => { expect(queryKeysForListEvent('item.created', 'list-1')).toEqual([['lists', 'list-1', 'items']]) expect(queryKeysForListEvent('item.updated', 'list-1')).toEqual([['lists', 'list-1', 'items']]) }) it('refreshes the list detail and the overview for membership and invitations', () => { for (const type of ['invitation.created', 'member.added', 'list.updated'] as const) { expect(queryKeysForListEvent(type, 'list-1')).toEqual([['lists', 'list-1'], ['lists']]) } }) })