Ai
2 Star 0 Fork 0

mirrors_sourcegraph/stripe-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
usage_record_test.go 851 Bytes
一键复制 编辑 原始数据 按行查看 历史
Remi Jannel 提交于 2018-04-15 03:12 +08:00 . Moving all int/uint to int64 for consistency
package stripe
import (
"strconv"
"testing"
assert "github.com/stretchr/testify/require"
"github.com/stripe/stripe-go/form"
)
func TestUsageRecordParams_AppendTo(t *testing.T) {
testCases := []struct {
field string
params *UsageRecordParams
want interface{}
}{
{"action", &UsageRecordParams{Action: String("increment")}, "increment"},
{"quantity", &UsageRecordParams{Quantity: Int64(2000)}, strconv.FormatUint(2000, 10)},
{"quantity", &UsageRecordParams{Quantity: Int64(0)}, strconv.FormatUint(0, 10)},
{"timestamp", &UsageRecordParams{Timestamp: Int64(123123123)}, strconv.FormatUint(123123123, 10)},
}
for _, tc := range testCases {
t.Run(tc.field, func(t *testing.T) {
body := &form.Values{}
form.AppendTo(body, tc.params)
values := body.ToValues()
assert.Equal(t, tc.want, values.Get(tc.field))
})
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_sourcegraph/stripe-go.git
git@gitee.com:mirrors_sourcegraph/stripe-go.git
mirrors_sourcegraph
stripe-go
stripe-go
master

搜索帮助