MCPcopy Index your code
hub / github.com/coder/coder / TestStopAndStoreRecording_Empty

Function TestStopAndStoreRecording_Empty

coderd/x/chatd/recording_internal_test.go:756–782  ·  view source on GitHub ↗

TestStopAndStoreRecording_Empty verifies that when the recording data is empty, stopAndStoreRecording returns an empty string and does NOT call InsertChatFile.

(t *testing.T)

Source from the content-addressed store, hash-verified

754// data is empty, stopAndStoreRecording returns an empty string and
755// does NOT call InsertChatFile.
756func TestStopAndStoreRecording_Empty(t *testing.T) {
757 t.Parallel()
758
759 db, ps := dbtestutil.NewDB(t)
760 ctx := chatdTestContext(t)
761
762 ctrl := gomock.NewController(t)
763 mockConn := agentconnmock.NewMockAgentConn(ctrl)
764
765 user, org, model := seedInternalChatDeps(t, db)
766 workspace, _, _ := seedWorkspaceBinding(t, db, user.ID)
767
768 server := newInternalTestServer(t, db, ps, chatprovider.ProviderAPIKeys{})
769 parent, _ := createParentChildChats(ctx, t, server, user, org, model)
770
771 // Build a multipart response with an empty video/mp4 part.
772 mockConn.EXPECT().
773 StopDesktopRecording(gomock.Any(), gomock.Any()).
774 Return(buildMultipartResponse(partSpec{"video/mp4", nil}), nil).Times(1)
775
776 recordingID := uuid.New().String()
777 result := server.stopAndStoreRecording(
778 ctx, mockConn, recordingID, parent.ID, user.ID,
779 uuid.NullUUID{UUID: workspace.ID, Valid: true},
780 )
781 assert.Empty(t, result.recordingFileID, "empty recording should not be stored")
782}
783
784// TestStopAndStoreRecording_LinkFailureRollsBackInsert verifies that a
785// chat-file cap rejection does not leave behind an unlinked recording row.

Callers

nothing calls this directly

Calls 14

EXPECTMethod · 0.95
NewDBFunction · 0.92
NewMockAgentConnFunction · 0.92
chatdTestContextFunction · 0.85
seedInternalChatDepsFunction · 0.85
seedWorkspaceBindingFunction · 0.85
newInternalTestServerFunction · 0.85
createParentChildChatsFunction · 0.85
buildMultipartResponseFunction · 0.85
stopAndStoreRecordingMethod · 0.80
StopDesktopRecordingMethod · 0.65
NewMethod · 0.65

Tested by

no test coverage detected