package jd

import (
	"testing"

	"git.rosy.net.cn/baseapi/utils"
	"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
	"git.rosy.net.cn/jx-callback/business/partner"
	"git.rosy.net.cn/jx-callback/business/partner/putils"
)

func TestGetStoreSkusBareInfo(t *testing.T) {
	// list := []*partner.StoreSkuInfo{
	// 	&partner.StoreSkuInfo{
	// 		SkuID:       2212,
	// 		VendorSkuID: "2019458103",
	// 	},
	// }
	// for i := 0; i < 30-1; i++ {
	// 	list = append(list, list[0])
	// }
	skuNameList, err := CurPurchaseHandler.GetSkus(jxcontext.AdminCtx, "", 0, "")
	if err != nil {
		t.Fatal(err)
	}
	list := putils.StoreSkuFullList2Bare(skuNameList)

	storeSkuList, err := CurPurchaseHandler.GetStoreSkusBareInfo(jxcontext.AdminCtx, "", nil, 2, "11053496", list)
	if err != nil {
		t.Fatal(err.Error())
	}
	var focusedStoreSkuList []*partner.StoreSkuInfo
	for _, v := range storeSkuList {
		if v.Stock > 0 {
			focusedStoreSkuList = append(focusedStoreSkuList, v)
		}
	}
	t.Log(utils.Format4Output(focusedStoreSkuList, false))
	t.Log(len(focusedStoreSkuList))
}
