package common_test import ( "testing" "fiskerinc.com/modules/common" "fiskerinc.com/modules/testhelper" ) func TestCarUpdateProgressCombine(t *testing.T) { status1 := common.CarUpdateProgress{ InstalledFiles: 0, TotalFiles: 1, PackageCurrent: 100, PackageTotal: 200, } status2 := common.CarUpdateProgress{ InstalledFiles: 1, TotalFiles: 2, PackageCurrent: 200, PackageTotal: 300, } status1.Combine(&status2) if status1.InstalledFiles != 1 { t.Errorf(testhelper.TestErrorTemplate, "InstalledFiles", 1, status1.InstalledFiles) } if status1.TotalFiles != 3 { t.Errorf(testhelper.TestErrorTemplate, "TotalFiles", 3, status1.TotalFiles) } if status1.PackageCurrent != 300 { t.Errorf(testhelper.TestErrorTemplate, "PackageCurrent", 300, status1.PackageCurrent) } if status1.PackageTotal != 500 { t.Errorf(testhelper.TestErrorTemplate, "PackageTotal", 500, status1.PackageTotal) } }