package mysql

import (
	"strings"
	"testing"

	"hyapp/services/wallet-service/internal/domain/ledger"
)

func TestRechargeBillsWhereUsesExclusiveEndMs(t *testing.T) {
	where, args := rechargeBillsWhereSQL(ledger.ListRechargeBillsQuery{
		AppCode:   "lalu",
		StartAtMS: 1778284800000,
		EndAtMS:   1778371200000,
	})
	if !strings.Contains(where, "rr.created_at_ms >= ?") || !strings.Contains(where, "rr.created_at_ms < ?") {
		t.Fatalf("recharge bill range must use [start_ms, end_ms): where=%s", where)
	}
	if len(args) != 3 || args[1] != int64(1778284800000) || args[2] != int64(1778371200000) {
		t.Fatalf("range args mismatch: %#v", args)
	}
}
