refactor: separate direct and related spot resolvers
Keep IsToken checks explicit across futures and direct spot symbols, move futures-derived spot mapping to a clearly named helper, and update token data collection to use related spot resolution. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -165,13 +165,25 @@ func TestIsToken(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestToken2SpotSymbols_AppliesExplicitRemap(t *testing.T) {
|
||||
func TestToken2SpotSymbols_DoesNotDependOnFutureMappings(t *testing.T) {
|
||||
withResolverMarketStub(t, &resolverMarketStub{
|
||||
futuresPairs: map[string]bool{"LUNA2USDT": true},
|
||||
spotPairs: map[string]bool{"LUNAUSDT": true},
|
||||
})
|
||||
|
||||
spots := Token2SpotSymbols("luna2")
|
||||
if len(spots) != 0 {
|
||||
t.Fatalf("expected no direct spot symbols for LUNA2, got %+v", spots)
|
||||
}
|
||||
}
|
||||
|
||||
func TestToken2RelatedSpotSymbols_AppliesExplicitRemap(t *testing.T) {
|
||||
withResolverMarketStub(t, &resolverMarketStub{
|
||||
futuresPairs: map[string]bool{"LUNA2USDT": true},
|
||||
spotPairs: map[string]bool{"LUNAUSDT": true},
|
||||
})
|
||||
|
||||
spots := Token2RelatedSpotSymbols("luna2")
|
||||
if len(spots) != 1 || spots[0] != "LUNAUSDT" {
|
||||
t.Fatalf("expected [LUNAUSDT], got %+v", spots)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user