7cd3583844
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FsEKyJrYF69Cj9ZXzFLRi
36 lines
1.3 KiB
Go
36 lines
1.3 KiB
Go
package lkgateway
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
// Код бумаги НРД вместо ISIN (M2M43 29.09.2026): из DEPO; явный код НРД не трогаем.
|
|
func TestWithNSDSecCodes(t *testing.T) {
|
|
nsdSecCodes.Lock()
|
|
nsdSecCodes.m["RU0009029540"] = nsdSecCodeEntry{code: "SBER/03", at: time.Now()}
|
|
nsdSecCodes.m["RU000A0JUR61"] = nsdSecCodeEntry{code: "", at: time.Now()}
|
|
nsdSecCodes.Unlock()
|
|
old := globalRC
|
|
if globalRC == nil {
|
|
globalRC = &RuntimeConfig{}
|
|
}
|
|
defer func() { globalRC = old }()
|
|
in := CreateClaimRequest{Securities: []ClaimSec{
|
|
{SecurityCode: "RU0009029540", SecurityDetails: SecurityDetails{ISIN: "RU0009029540"}},
|
|
{SecurityCode: "", SecurityDetails: SecurityDetails{ISIN: "RU0009029540"}},
|
|
{SecurityCode: "RU000A0JUR61", SecurityDetails: SecurityDetails{ISIN: "RU000A0JUR61"}},
|
|
{SecurityCode: "SU26238RMFS4", SecurityDetails: SecurityDetails{ISIN: "RU000A1038V6"}},
|
|
}}
|
|
out := withNSDSecCodes(in)
|
|
want := []string{"SBER/03", "SBER/03", "RU000A0JUR61", "SU26238RMFS4"}
|
|
for i, w := range want {
|
|
if out.Securities[i].SecurityCode != w {
|
|
t.Fatalf("бумага %d: %q, ожидалось %q", i, out.Securities[i].SecurityCode, w)
|
|
}
|
|
}
|
|
if in.Securities[0].SecurityCode != "RU0009029540" {
|
|
t.Fatal("исходная заявка не меняется")
|
|
}
|
|
}
|