Skip to content

Comments

test(web): fix and complete Calendar/Sidebar render + interaction integration tests#1193

Merged
tyler-dane merged 17 commits intoSwitchbackTech:mainfrom
BrainLeaked6628:bugfix/1022-calendar-sidebar-integration-tests
Nov 5, 2025
Merged

test(web): fix and complete Calendar/Sidebar render + interaction integration tests#1193
tyler-dane merged 17 commits intoSwitchbackTech:mainfrom
BrainLeaked6628:bugfix/1022-calendar-sidebar-integration-tests

Conversation

@BrainLeaked6628
Copy link
Contributor

@BrainLeaked6628 BrainLeaked6628 commented Nov 3, 2025

Fixes #1022

Problem

  • Calendar.render/Sidebar.render and their interactions tests were stubbed or commented out.
  • Missing realistic integration coverage; preloaded state not strongly typed.

What I changed

  • Sidebar.render.test.tsx

    • Empty state: assert headers (“This Week”, “This Month”), “+” placeholders, divider, complementary landmark.
    • Preloaded state: assert “Europe Trip”.
  • Sidebar.interactions.test.tsx

    • Open/close Someday form (preloaded state).
    • Add Someday event via “+” and Save (preloaded state, MSW, auth mocked).
  • Calendar.form.test.tsx (related stability for reminder feature)

    • Unskipped and stabilized editable reminder tests (’r’ shortcut and Command Palette).
    • Close-on-outside-click and Trash action.
    • Mock event-target visibility and IntersectionObserver.

Note

Completes Calendar/Sidebar integration tests, stabilizes mocks and dates, updates Jest matching, and ensures someday edits apply only to the targeted instance.

  • Web
    • Logic: In useSidebarActions.ts, force applyTo: THIS_EVENT for someday edits (avoid ALL_EVENTS), allowing per-instance customization.
    • Calendar Tests:
      • Calendar.form.test.tsx: Add mocks (IntersectionObserver, visibility), close-on-outside-click, trash delete flow, reminder focus via shortcut and command palette.
      • Calendar.render.test.tsx: Mock scroll; assert single scroll call and key UI elements.
    • Sidebar Tests:
      • Sidebar.render.test.tsx: Assert empty-state sections and preloaded someday event rendering.
      • Sidebar.interactions.test.tsx: Open/close existing someday form; create/save new someday via "+" (MSW + mocked auth).
  • Backend
    • Add someday recurring instance update test in instance.test.ts verifying only the targeted instance changes and base/others remain unchanged.
  • Core Mocks
    • events.misc.ts: Make EUROPE_TRIP dates use local today to avoid timezone flakiness.
  • Config
    • jest.config.js (web project): Broaden testMatch to packages/web/**/*.(test|spec).[jt]s?(x).

Written by Cursor Bugbot for commit 6e664cc. This will update automatically on new commits. Configure here.

@tyler-dane tyler-dane requested a review from Copilot November 3, 2025 23:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request re-enables previously commented-out test cases for the Calendar Sidebar component and updates related test infrastructure. The changes focus on improving test coverage by activating existing test scenarios and modernizing test patterns.

  • Uncommented and updated test cases for Sidebar rendering and interactions
  • Updated mock data to use dynamic dates for test reliability
  • Added necessary test setup (scroll mock, IntersectionObserver mock)

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
Sidebar.render.test.tsx Re-enabled tests for sidebar display with and without state, added scroll mock setup
Sidebar.interactions.test.tsx Re-enabled interaction tests for opening/closing forms and adding someday events
Calendar.render.test.tsx Added scroll mock to prevent console warnings during tests
Calendar.form.test.tsx Added IntersectionObserver mock and re-enabled command palette test with keyboard shortcut fix
events.misc.ts Updated EUROPE_TRIP dates to use current date for test stability
jest.config.js Standardized test file pattern matching
Comments suppressed due to low confidence (6)

packages/web/src/views/Calendar/Calendar.form.test.tsx:3

  • Unused import fireEvent.
import { fireEvent, screen, waitFor, within } from "@testing-library/react";

packages/web/src/views/Calendar/Calendar.form.test.tsx:8

  • Unused import viewSlice.
import { viewSlice } from "@web/ducks/events/slices/view.slice";

packages/web/src/views/Calendar/Calendar.form.test.tsx:9

  • Unused import store.
import { store } from "@web/store";

packages/web/src/views/Calendar/components/Sidebar/Sidebar.render.test.tsx:2

  • Unused import Provider.
import { Provider } from "react-redux";

packages/web/src/views/Calendar/components/Sidebar/Sidebar.render.test.tsx:3

  • Unused import configureStore.
import { configureStore } from "@reduxjs/toolkit";

packages/web/src/views/Calendar/components/Sidebar/Sidebar.render.test.tsx:10

  • Unused import rtlRender.
import {
  render as rtlRender,
  screen,
  waitFor,
  within,
} from "@testing-library/react";

Copy link
Contributor

@tyler-dane tyler-dane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @BrainLeaked6628 , this is looking great! I tweaked a few things to minimize the console warnings. I'll be deploying this shortly and merge assuming all goes well

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

tyler-dane and others added 2 commits November 4, 2025 18:04
… instances (SwitchbackTech#1164)

* Initial plan

* fix(web): ensure someday recurring events edit only individual instances

Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com>

* refactor(web): remove redundant isSomeday variable in useSidebarActions

Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com>
@tyler-dane
Copy link
Contributor

007

LGTM, congrats on your first PR!

@tyler-dane tyler-dane merged commit 8393ee3 into SwitchbackTech:main Nov 5, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Calendar.render and Sidebar.render integration tests

3 participants