Skip to content

Add missing unit tests for FunctionEditPage#42

Open
Cragsmann wants to merge 2 commits into
functions-dev:masterfrom
Cragsmann:SRVOCF-844--edit-page-tests
Open

Add missing unit tests for FunctionEditPage#42
Cragsmann wants to merge 2 commits into
functions-dev:masterfrom
Cragsmann:SRVOCF-844--edit-page-tests

Conversation

@Cragsmann

@Cragsmann Cragsmann commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Changes

  • 🎁 Add 10 new unit tests for FunctionEditPage, bringing total coverage from 6 to 16 tests
  • 🧹 Enhance CodeEditor mock to expose value, language, and emptyState props
  • 🐛 Fix setupPushHandlers to use wildcard :sha param for getCommit (was hardcoded to head-sha, broke on cached commit SHAs)

New test cases

Edit page hook (useFunctionEditPage):

  • File selection changes editor content
  • Dirty tracking marks Save enabled after edit
  • Dirty tracking resets (Save disabled) after save
  • Edited content persists across file switches
  • Language detection updates when selecting different file types
  • Save triggers GitHub push API calls
  • Save error shows danger alert
  • Save button disabled while save is in progress

Toolbar integration:

  • Error alert clears when next save succeeds

Empty/loading states:

  • Empty state shows "Start editing" placeholder

Relates to SRVOCF-844

@dsimansk dsimansk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great work, looks good to me. :)

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.

2 participants