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 {
|
const {
|
||||||
mockFind,
|
mockFind,
|
||||||
mockSort,
|
mockSort,
|
||||||
mockSelect,
|
|
||||||
mockLean,
|
mockLean,
|
||||||
mockGetOptionalMember,
|
mockGetOptionalMember,
|
||||||
mockLoadPublicEvent
|
mockLoadPublicEvent
|
||||||
} = vi.hoisted(() => ({
|
} = vi.hoisted(() => ({
|
||||||
mockFind: vi.fn(),
|
mockFind: vi.fn(),
|
||||||
mockSort: vi.fn(),
|
mockSort: vi.fn(),
|
||||||
mockSelect: vi.fn(),
|
|
||||||
mockLean: vi.fn(),
|
mockLean: vi.fn(),
|
||||||
mockGetOptionalMember: vi.fn(),
|
mockGetOptionalMember: vi.fn(),
|
||||||
mockLoadPublicEvent: vi.fn()
|
mockLoadPublicEvent: vi.fn()
|
||||||
|
|
@ -36,8 +34,7 @@ vi.mock('../../../../server/utils/loadEvent.js', () => ({
|
||||||
|
|
||||||
function setupFindChain(result = []) {
|
function setupFindChain(result = []) {
|
||||||
mockLean.mockResolvedValue(result)
|
mockLean.mockResolvedValue(result)
|
||||||
mockSelect.mockReturnValue({ lean: mockLean })
|
mockSort.mockReturnValue({ lean: mockLean })
|
||||||
mockSort.mockReturnValue({ select: mockSelect })
|
|
||||||
mockFind.mockReturnValue({ sort: mockSort })
|
mockFind.mockReturnValue({ sort: mockSort })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue