1b0e1bee5f
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FsEKyJrYF69Cj9ZXzFLRi
33 lines
1.2 KiB
Go
33 lines
1.2 KiB
Go
package lkgateway
|
||
|
||
import "testing"
|
||
|
||
func TestLKPaperTypeAndPairs(t *testing.T) {
|
||
for cfi, want := range map[string]string{"ESVXFR": "share", "EDSXFR": "depositary_receipt", "DBFXFR": "bond", "CEOGMR": "fund"} {
|
||
if got := lkPaperType(cfi, ""); got != want {
|
||
t.Fatalf("%s: %s", cfi, got)
|
||
}
|
||
}
|
||
if lkPaperType("", "ОФЗ 26238 ПД обл") != "bond" || lkPaperType("", "БПИФ «Ликвидность» фонд") != "fund" {
|
||
t.Fatal("по названию")
|
||
}
|
||
p := LKPortfolioSyncSettings{Pairs: "ДД-816=БР-859; мусор ;ДД-1 = БР-1"}.pairs()
|
||
if len(p) != 2 || p[0].LK != "ДД-816" || p[0].Depo != "БР-859" || p[1].Depo != "БР-1" {
|
||
t.Fatalf("%+v", p)
|
||
}
|
||
}
|
||
|
||
func TestLKContractByAccount(t *testing.T) {
|
||
def := LKPortfolioSyncSettings{}
|
||
if got := lkContractByAccount(def, "ВТНКЦ00000816"); got != "ДД-816" {
|
||
t.Fatalf("по умолчанию: %q", got)
|
||
}
|
||
if got := lkContractByAccount(def, "В00000816"); got != "" {
|
||
t.Fatalf("не торговый счёт: %q", got)
|
||
}
|
||
other := LKPortfolioSyncSettings{AccountPrefix: "TR-", ContractTemplate: "D/{n}/2024"}
|
||
if got := lkContractByAccount(other, "TR-0042"); got != "D/42/2024" {
|
||
t.Fatalf("другое именование: %q", got)
|
||
}
|
||
}
|