tct_test.go 842 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package controllers_scraper
  2. import (
  3. "kkscrap-go/model"
  4. "testing"
  5. )
  6. func TestToProduct(t *testing.T) {
  7. ori := model.ItemInfo{
  8. SolutionName: "hello",
  9. Version: "",
  10. Emails: nil,
  11. DomainName: "",
  12. DomainURI: "",
  13. ItemName: "",
  14. ItemNick: "",
  15. ModelName: "",
  16. ModelNo: "",
  17. BrandName: "",
  18. Sku: "",
  19. ItemCategory: "",
  20. Manufacturer: "",
  21. Origin: "",
  22. Language: "",
  23. Currency: "",
  24. SalesPrice: 0,
  25. DeliveryPrice: 0,
  26. MinimumQty: 0,
  27. UserCredit: 0,
  28. Options: nil,
  29. Images: nil,
  30. ShortDesc: "",
  31. OriginDesc: "",
  32. TextDesc: "1234",
  33. }
  34. pro := toProductPage(ori)
  35. if pro.TextDesc != "1234" {
  36. t.Error("TextDesc is not equal")
  37. }
  38. if pro.SolutionName != "hello" {
  39. t.Error("SolutionType is not equal")
  40. }
  41. }