package mtwm

import (
	"testing"

	"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
	"git.rosy.net.cn/baseapi/utils"
	// _ "git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
)

//func TestReadStore(t *testing.T) {
//	store, err := CurPurchaseHandler.ReadStore(jxcontext.AdminCtx, "", "4351018")
//	if err != nil {
//		t.Fatal(err)
//	}
//	t.Log(utils.Format4Output(store, false))
//}

func TestUpdateStore(t *testing.T) {
	err := CurPurchaseHandler.UpdateStore(nil, 100002, "test")
	if err != nil {
		t.Fatal(err)
	}
}

func TestConstrainOpTimeList(t *testing.T) {
	timeList := constrainOpTimeList([]int16{830, 1800}, []int16{
		0,
		200,
		930,
		1700,
	})
	t.Log(utils.Format4Output(timeList, false))
	if timeList[0] != 930 || timeList[1] != 1700 {
		t.Fatal("constrainOpTimeList failed")
	}
}

func TestGetOpTimeListFromErr(t *testing.T) {
	err := utils.NewErrorIntCode("当前配送营业时间为:07:00~24:00", mtwmapi.ErrCodeOpFailed)
	list := getOpTimeListFromErr(err)
	t.Log(list)
}
