test(events): update list mock chain after removing .select() projection
GET /api/events now does find().sort().lean() (no .select()) since the handler strips registrations in the map step. The mock chain in members-only-visibility.test.js still expected .select(), causing all list tests to throw "lean is not a function".
This commit is contained in:
parent
384d3197ce
commit
cc89c28f03
1 changed files with 1 additions and 4 deletions
|
|
@ -5,14 +5,12 @@ import { createMockEvent } from '../../helpers/createMockEvent.js'
|
|||
const {
|
||||
mockFind,
|
||||
mockSort,
|
||||
mockSelect,
|
||||
mockLean,
|
||||
mockGetOptionalMember,
|
||||
mockLoadPublicEvent
|
||||
} = vi.hoisted(() => ({
|
||||
mockFind: vi.fn(),
|
||||
mockSort: vi.fn(),
|
||||
mockSelect: vi.fn(),
|
||||
mockLean: vi.fn(),
|
||||
mockGetOptionalMember: vi.fn(),
|
||||
mockLoadPublicEvent: vi.fn()
|
||||
|
|
@ -36,8 +34,7 @@ vi.mock('../../../../server/utils/loadEvent.js', () => ({
|
|||
|
||||
function setupFindChain(result = []) {
|
||||
mockLean.mockResolvedValue(result)
|
||||
mockSelect.mockReturnValue({ lean: mockLean })
|
||||
mockSort.mockReturnValue({ select: mockSelect })
|
||||
mockSort.mockReturnValue({ lean: mockLean })
|
||||
mockFind.mockReturnValue({ sort: mockSort })
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue