MCPcopy Create free account
hub / github.com/bytebase/bytebase / TestChange_ProjectDerived

Function TestChange_ProjectDerived

backend/api/mcp/tool_change_test.go:701–723  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

699}
700
701func TestChange_ProjectDerived(t *testing.T) {
702 mock := newChangeMock(employeeDB())
703 s := newChangeTestServer(t, mock)
704
705 _, structured, err := s.handleChange(testContext(), nil, ChangeInput{
706 Database: "employee_db",
707 SQL: "ALTER TABLE x ADD COLUMN y INT",
708 Title: "Test",
709 })
710 require.NoError(t, err)
711
712 output, ok := structured.(*ChangeOutput)
713 require.True(t, ok)
714 require.Equal(t, "projects/hr-system", output.Project)
715
716 // All API calls use the correct project parent.
717 sheet := mock.getCapturedSheet()
718 require.Equal(t, "projects/hr-system", sheet["parent"])
719 plan := mock.getCapturedPlan()
720 require.Equal(t, "projects/hr-system", plan["parent"])
721 issue := mock.getCapturedIssue()
722 require.Equal(t, "projects/hr-system", issue["parent"])
723}
724
725func TestChange_ProjectWrongFilter(t *testing.T) {
726 mock := newChangeMock(employeeDB())

Callers

nothing calls this directly

Calls 9

newChangeMockFunction · 0.85
employeeDBFunction · 0.85
newChangeTestServerFunction · 0.85
testContextFunction · 0.85
handleChangeMethod · 0.80
getCapturedSheetMethod · 0.80
getCapturedPlanMethod · 0.80
getCapturedIssueMethod · 0.80
EqualMethod · 0.65

Tested by

no test coverage detected