test: migrate RearrangeChannelsPage, AvailableChannelsPage, NewChannelVersionPage from VTU to VTL (Part 2-4/4) (#14261) - #15002
Conversation
|
👋 Hi @soaebhasan12, thanks for contributing! For the review process to begin, please verify that the following is satisfied:
Also check that issue requirements are satisfied & you ran Pull requests that don't follow the guidelines will be closed. Reviewer assignment can take up to 2 weeks. |
|
hello @AlexVelezLl @rtibblesbot jest.mock('kolibri-common/components/sortable/DragContainer', () => ({
default: {
name: 'DragContainer',
props: ['items'],
template: `<div><button data-testid="trigger-sort" @click="...">...</button><slot /></div>`,
},
}));The problem: when there are channels to show, nothing renders inside that mocked I'm guessing it might have something to do with Draggable/DragHandle (the children Any suggestions on how to approach mocking this component correctly? |
|
Hey @soaebhasan12! Could you check why the current mock works, and what the difference is? Could you also rebase against the latest develop now that we have made some changes to the DragContainer implementation? Perhaps that could help! |
Thanks @AlexVelezLl! Rebased against develop and figured it out. You were right — the develop branch now uses jest.mock(
'sortablejs',
() => jest.fn().mockImplementation((el, options) => ({ destroy: jest.fn(), options })),
{ virtual: true },
);This lets the real DragContainer (and its Draggable/DragHandle children) render normally, and I can grab the captured onEnd callback from Sortable.mock.results to simulate a completed drag. All tests pass now. Thanks for pointing me in the right direction! |
b7e02d7 to
7aa4a4c
Compare
|
Update: RearrangeChannelsPage.spec.js is complete — all 7 tests passing Moving on to AvailableChannelsPage.spec.js next, which I understand is the more |
Summary
Migrate remaining device plugin tests to Vue Testing Library as part of issue #14261.
This is Part 2-4 of 4 — consolidated into a single PR per reviewer guidance on PR #14883:
Each file has its own commit(s) for easier review.
Status
This is a draft/work-in-progress PR opened early to get feedback on an open question
(see comment below) before continuing with the remaining files.
Open question
I'm stuck on mocking
DragContainerfor RearrangeChannelsPage — see comment below for details.AI usage
I used Claude AI as a learning tool and coding assistant during this VTL migration,
consistent with the approach disclosed in PR #14883.