Summary
packages/shared/src/components/sidebar/Sidebar.spec.tsx → should require login before opening following for anonymous users has been failing on main since the sidebar rework landed.
Failing test
it('should require login before opening following for anonymous users', async () => {
renderComponent(defaultAlerts, [createMockFeedSettings()], undefined);
const item = await screen.findByText('Following');
fireEvent.click(item);
expect(showLogin).toHaveBeenCalledWith({
trigger: 'Following',
});
});
Observed error
expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: {"trigger": "Following"}
Number of calls: 0
showLogin is never invoked when an anonymous user clicks the Following sidebar item. The Following entry in sidebar/sections/MainSection.tsx is set to requiresLogin: true, and SidebarItem / ClickableNavItem look correct on a static read, so the regression is subtle.
Where it originated
Introduced as part of ee36f20e7 feat: add happening now to sidebar — the commit switched renderComponent(..., null) to renderComponent(..., undefined) and moved the settings context over to createTestSettings(...). I suspect the regression is in how the new createTestSettings fixture or the undefined user path flows through AuthContext, rather than a product bug.
Impact
Reproduction
git checkout main
pnpm --filter @dailydotdev/shared test -- --testPathPattern='sidebar/Sidebar.spec'
→ Tests: 1 failed, 10 passed, 11 total.
Suggested fix
Either restore the old SettingsContextData fixture in the test (to rule out the fixture change) or add a console/print inside ClickableNavItem.onClick to confirm whether showLogin is being invoked with an unexpected argument, or the click target is not the anchor with the handler.
cc @idoshamun — this was from the "happening now" sidebar rework; happy to pair on a fix if helpful, but flagging here so it can be picked up on main.
Summary
packages/shared/src/components/sidebar/Sidebar.spec.tsx→should require login before opening following for anonymous usershas been failing onmainsince the sidebar rework landed.Failing test
Observed error
showLoginis never invoked when an anonymous user clicks the Following sidebar item. TheFollowingentry insidebar/sections/MainSection.tsxis set torequiresLogin: true, andSidebarItem/ClickableNavItemlook correct on a static read, so the regression is subtle.Where it originated
Introduced as part of
ee36f20e7 feat: add happening now to sidebar— the commit switchedrenderComponent(..., null)torenderComponent(..., undefined)and moved the settings context over tocreateTestSettings(...). I suspect the regression is in how the newcreateTestSettingsfixture or theundefineduser path flows throughAuthContext, rather than a product bug.Impact
test_shared→buildworkflow is red onmain(confirmed on tip-of-main63f752532): https://app.circleci.com/pipelines/gh/dailydotdev/apps/ (see any recentmainbuild).mainin — e.g. feat(shortcuts): redesign new-tab shortcuts hub #5903 — inherits the red check, blocking merges on anything that requires a green build.Reproduction
→
Tests: 1 failed, 10 passed, 11 total.Suggested fix
Either restore the old
SettingsContextDatafixture in the test (to rule out the fixture change) or add a console/print insideClickableNavItem.onClickto confirm whethershowLoginis being invoked with an unexpected argument, or the click target is not the anchor with the handler.cc @idoshamun — this was from the "happening now" sidebar rework; happy to pair on a fix if helpful, but flagging here so it can be picked up on
main.