CI / build (push) Successful in 34s
The shop's T5 filter (maturity_rating "t5") is answered from the hub's products, fetched so they can be
shown and tried on; buying T5 products adds them to the hub library, and product.php details for
community products are answered here.
The client sends some product IDs as floats ("2000000008.0"): product.php passed the worn community
product to IMVU that way. Every ID is now read either way, and products.Guard refuses any request to
IMVU that still names a local ID given out. T5DE_PROXY_DUMP logs request and response bodies.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
17 lines
429 B
Go
17 lines
429 B
Go
package products
|
|
|
|
import "testing"
|
|
|
|
func TestParseID(t *testing.T) {
|
|
for s, want := range map[string]int64{"2000000008": 2000000008, "2000000008.0": 2000000008, " 80 ": 80, "2e9": 2000000000} {
|
|
if got, ok := parseID(s); !ok || got != want {
|
|
t.Errorf("parseID(%q) = %d, %v", s, got, ok)
|
|
}
|
|
}
|
|
for _, s := range []string{"", "1.5", "abc", "1e300"} {
|
|
if _, ok := parseID(s); ok {
|
|
t.Errorf("parseID(%q) ok", s)
|
|
}
|
|
}
|
|
}
|