TestStopAndStoreRecording_Empty verifies that when the recording data is empty, stopAndStoreRecording returns an empty string and does NOT call InsertChatFile.
(t *testing.T)
| 754 | // data is empty, stopAndStoreRecording returns an empty string and |
| 755 | // does NOT call InsertChatFile. |
| 756 | func 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. |
nothing calls this directly
no test coverage detected