package controllers_scraper import ( "kkscrap-go/model" "testing" ) func TestToProduct(t *testing.T) { ori := model.ItemInfo{ SolutionName: "hello", Version: "", Emails: nil, DomainName: "", DomainURI: "", ItemName: "", ItemNick: "", ModelName: "", ModelNo: "", BrandName: "", Sku: "", ItemCategory: "", Manufacturer: "", Origin: "", Language: "", Currency: "", SalesPrice: 0, DeliveryPrice: 0, MinimumQty: 0, UserCredit: 0, Options: nil, Images: nil, ShortDesc: "", OriginDesc: "", TextDesc: "1234", } pro := toProductPage(ori) if pro.TextDesc != "1234" { t.Error("TextDesc is not equal") } if pro.SolutionName != "hello" { t.Error("SolutionType is not equal") } }