Skip to content

Fix test expectation for fs.readFile call count in agent-service.test.ts#92

Merged
GTheMachine merged 2 commits intofix-agent-runnerfrom
copilot/fix-build-tests-issue
Dec 14, 2025
Merged

Fix test expectation for fs.readFile call count in agent-service.test.ts#92
GTheMachine merged 2 commits intofix-agent-runnerfrom
copilot/fix-build-tests-issue

Conversation

Copy link

Copilot AI commented Dec 14, 2025

The test "should reuse existing session if already started" expected fs.readFile to be called once, but startConversation actually calls it twice on first invocation: once for loadSession() and once for loadMetadata().

Changes

  • Updated test expectation from toHaveBeenCalledTimes(1) to toHaveBeenCalledTimes(2)
  • Added comment clarifying the call sequence
// First call reads session file and metadata file (2 calls)
// Second call should reuse in-memory session (no additional calls)
expect(fs.readFile).toHaveBeenCalledTimes(2);
Original prompt

can you fix the build tests and Test Suite / test (pull_request)Failing after 1m


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

The test "should reuse existing session if already started" expected fs.readFile to be called 1 time, but startConversation calls it 2 times on first call (loadSession + loadMetadata). The second call correctly reuses the in-memory session.

Co-authored-by: GTheMachine <156854865+GTheMachine@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix build tests and test suite failures Fix test expectation for fs.readFile call count in agent-service.test.ts Dec 14, 2025
Copilot AI requested a review from GTheMachine December 14, 2025 18:58
@GTheMachine GTheMachine marked this pull request as ready for review December 14, 2025 19:20
Copilot AI review requested due to automatic review settings December 14, 2025 19:20
Copy link

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 PR fixes a failing test by correcting the expected call count for fs.readFile in the "should reuse existing session if already started" test case. The test was previously expecting 1 call but actually receives 2 calls because startConversation invokes both loadSession() and loadMetadata() on its first invocation.

  • Updated the assertion from toHaveBeenCalledTimes(1) to toHaveBeenCalledTimes(2) to reflect actual behavior
  • Added explanatory comment to clarify why 2 calls are expected

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +106 to +107
// First call reads session file and metadata file (2 calls)
// Second call should reuse in-memory session (no additional calls)
Copy link

Copilot AI Dec 14, 2025

Choose a reason for hiding this comment

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

The comment is slightly ambiguous. Consider clarifying that "First call" refers to the first invocation of startConversation (not the first readFile call). For example: "First startConversation invocation reads session file and metadata file (2 calls). Second invocation should reuse in-memory session (no additional calls)"

Suggested change
// First call reads session file and metadata file (2 calls)
// Second call should reuse in-memory session (no additional calls)
// First startConversation invocation reads session file and metadata file (2 calls)
// Second startConversation invocation should reuse in-memory session (no additional calls)

Copilot uses AI. Check for mistakes.
@GTheMachine GTheMachine merged commit 790a1b8 into fix-agent-runner Dec 14, 2025
10 checks passed
@GTheMachine GTheMachine deleted the copilot/fix-build-tests-issue branch December 14, 2025 19:36
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