Files
Bridge-and-Join-s/internal/lkgateway/lkhistory_live_test.go
T

43 lines
1.2 KiB
Go

//go:build live
package lkgateway
import (
"context"
"testing"
)
// Движения и доходы клиента из учётной системы.
func TestLiveHistory(t *testing.T) {
rc, err := NewRuntimeConfig("/var/lib/bj/.bj/setup.json")
if err != nil {
t.Fatal(err)
}
globalRC = rc
fs := rc.Snapshot().Fancy
for _, contract := range []string{"БР-2000", "БР-1529", "БР-859"} {
ops, err := lkOperations(context.Background(), fs, contract, "2024-01-01", "", 20)
if err != nil {
t.Fatalf("операции %s: %v", contract, err)
}
t.Logf("%s: операций %d", contract, len(ops))
for i, o := range ops {
if i > 4 {
break
}
t.Logf(" %s %s %s %s %.0f %s %s", o.Date, o.Kind, o.Account, o.Security, o.Quantity, o.State, o.Note)
}
inc, tax, err := lkIncome(context.Background(), fs, contract, "2024-01-01", "")
if err != nil {
t.Fatalf("доходы %s: %v", contract, err)
}
t.Logf("%s: выплат %d, налог по журналу %.2f", contract, len(inc), tax)
for i, p := range inc {
if i > 4 {
break
}
t.Logf(" %s %s %s начислено %.2f налог %.2f к выплате %.2f %s", p.Date, p.Kind, p.Security, p.Accrued, p.Tax, p.Paid, p.State)
}
}
}