diff --git a/src/internal/kopia/upload_test.go b/src/internal/kopia/upload_test.go index 3a27834d0..6ceb43cca 100644 --- a/src/internal/kopia/upload_test.go +++ b/src/internal/kopia/upload_test.go @@ -1739,6 +1739,40 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto }, ), }, + { + name: "ReplaceDeletedSubtreeWithNew", + inputCollections: func(t *testing.T) []data.BackupCollection { + oldInbox := mockconnector.NewMockExchangeCollection(inboxStorePath, inboxLocPath, 0) + oldInbox.PrevPath = inboxStorePath + oldInbox.ColState = data.DeletedState + + newCol := mockconnector.NewMockExchangeCollection(inboxStorePath, inboxLocPath, 1) + newCol.ColState = data.NewState + newCol.Names[0] = workFileName2 + newCol.Data[0] = workFileData2 + + return []data.BackupCollection{oldInbox, newCol} + }, + expected: expectedTreeWithChildren( + []string{ + testTenant, + service, + testUser, + category, + }, + []*expectedNode{ + { + name: testInboxID, + children: []*expectedNode{ + { + name: workFileName2, + data: workFileData2, + }, + }, + }, + }, + ), + }, { name: "ReplaceMovedDirectory", inputCollections: func(t *testing.T) []data.BackupCollection {