skip spin off actions
Generate check / check-changes (pull_request) Successful in 2s
Generate check / verify-generate (pull_request) Skipped
Quality / check-changes (pull_request) Successful in 3s
Quality / static-checks (pull_request) Successful in 21s
Quality / run-tests (pull_request) Successful in 52s
Generate check / check-changes (pull_request) Successful in 2s
Generate check / verify-generate (pull_request) Skipped
Quality / check-changes (pull_request) Successful in 3s
Quality / static-checks (pull_request) Successful in 21s
Quality / run-tests (pull_request) Successful in 52s
This commit is contained in:
@@ -2,6 +2,7 @@ package trading212
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
@@ -371,6 +372,36 @@ func ShouldParseDecimal(t testing.TB, sf string) decimal.Decimal {
|
||||
return bf
|
||||
}
|
||||
|
||||
func TestRecordReader_ReadRecord_SkipsCorporateActions(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
row string
|
||||
}{
|
||||
{
|
||||
name: "spin off",
|
||||
row: `Spin off,2026-02-11 13:41:43+00:00,US9418481035,WAT,"Waters",EOF46451921527,0.0406450000,0E-10,USD,,,,0.00,"EUR",,,,,,`,
|
||||
},
|
||||
{
|
||||
name: "stock distribution",
|
||||
row: `Stock distribution,2025-08-04 11:45:30,XX1234567890,ABXY,"Aspargus Broccoli",EOF987654321,2.4387014200,7.9999999999,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
rr := NewRecordReader(
|
||||
bytes.NewBufferString(tt.row),
|
||||
NewFigiClientSecurityTypeStub(t, "Common Stock"),
|
||||
)
|
||||
|
||||
_, err := rr.ReadRecord(t.Context())
|
||||
if !errors.Is(err, io.EOF) {
|
||||
t.Fatalf("want EOF after skipping %s, got: %v", tt.name, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
type RoundTripFunc func(req *http.Request) (*http.Response, error)
|
||||
|
||||
func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
|
||||
Reference in New Issue
Block a user