package pddapi

import (
	"fmt"
	"git.rosy.net.cn/baseapi/utils"
	"testing"
	"time"
)

func TestGoodsCatsGet(t *testing.T) {
	result, err := api.GoodsCatsGet(0)
	if err != nil {
		t.Fatal(err)
	}
	t.Log(utils.Format4Output(result, false))
}

func TestGoodsSearch(t *testing.T) {
	result, err := api.GoodsSearch(&GoodsSearchParam{
		Page:     1,
		PageSize: 10,
	})
	if err != nil {
		t.Fatal(err)
	}
	t.Log(utils.Format4Output(result, false))
}

func TestGoodsDetail(t *testing.T) {
	result, err := api.GoodsDetail("Y9j2gIAgrxpKWDjRwfDZdyHfazgTDQpH_JyzHgT6ly")
	if err != nil {
		t.Fatal(err)
	}
	t.Log(utils.Format4Output(result, false))
}

func TestGoodsRecommendGet(t *testing.T) {
	result, err := api.GoodsRecommendGet("Y9j2gIAgrxpKWDjRwfDZdyHfazgTDQpH_JyzHgT6ly", 3, 0, 10)
	if err != nil {
		t.Fatal(err)
	}
	t.Log(utils.Format4Output(result, false))
}

func TestName(t *testing.T) {
	cc := time.Now().Add(-2 * time.Minute)
	aa := cc.Sub(time.Now()).Seconds()
	bb := time.Now().Sub(cc).Seconds()
	fmt.Println(aa)
	fmt.Println(bb)
}
