fix typos
All checks were successful
Generate check / check-changes (push) Successful in 3s
Generate check / check-generate (push) Has been skipped
Generate check / check-changes (pull_request) Successful in 3s
Tests / check-changes (pull_request) Successful in 3s
Generate check / check-generate (pull_request) Has been skipped
Tests / tests (pull_request) Successful in 7s
All checks were successful
Generate check / check-changes (push) Successful in 3s
Generate check / check-generate (push) Has been skipped
Generate check / check-changes (pull_request) Successful in 3s
Tests / check-changes (pull_request) Successful in 3s
Generate check / check-generate (pull_request) Has been skipped
Tests / tests (pull_request) Successful in 7s
This commit is contained in:
@@ -18,7 +18,7 @@ func TestFillerQueue(t *testing.T) {
|
|||||||
var rq FillerQueue
|
var rq FillerQueue
|
||||||
|
|
||||||
if rq.Len() != 0 {
|
if rq.Len() != 0 {
|
||||||
t.Fatalf("zero value should have zero lenght")
|
t.Fatalf("zero value should have zero length")
|
||||||
}
|
}
|
||||||
|
|
||||||
_, ok := rq.Pop()
|
_, ok := rq.Pop()
|
||||||
@@ -38,12 +38,12 @@ func TestFillerQueue(t *testing.T) {
|
|||||||
|
|
||||||
rq.Push(NewFiller(newRecord()))
|
rq.Push(NewFiller(newRecord()))
|
||||||
if rq.Len() != 1 {
|
if rq.Len() != 1 {
|
||||||
t.Fatalf("pushing 1st record should result in lenght of 1")
|
t.Fatalf("pushing 1st record should result in length of 1")
|
||||||
}
|
}
|
||||||
|
|
||||||
rq.Push(NewFiller(newRecord()))
|
rq.Push(NewFiller(newRecord()))
|
||||||
if rq.Len() != 2 {
|
if rq.Len() != 2 {
|
||||||
t.Fatalf("pushing 2nd record should result in lenght of 2")
|
t.Fatalf("pushing 2nd record should result in length of 2")
|
||||||
}
|
}
|
||||||
|
|
||||||
peekFiller, ok := rq.Peek()
|
peekFiller, ok := rq.Peek()
|
||||||
@@ -85,7 +85,7 @@ func TestFillerQueueNilReceiver(t *testing.T) {
|
|||||||
var rq *FillerQueue
|
var rq *FillerQueue
|
||||||
|
|
||||||
if rq.Len() > 0 {
|
if rq.Len() > 0 {
|
||||||
t.Fatalf("nil receiver should have zero lenght")
|
t.Fatalf("nil receiver should have zero length")
|
||||||
}
|
}
|
||||||
|
|
||||||
_, ok := rq.Peek()
|
_, ok := rq.Peek()
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ func NewTableWriter(w io.Writer) *TableWriter {
|
|||||||
t.SetAutoIndex(true)
|
t.SetAutoIndex(true)
|
||||||
t.SetStyle(table.StyleLight)
|
t.SetStyle(table.StyleLight)
|
||||||
|
|
||||||
t.AppendHeader(table.Row{"", "", "Realisation", "Realisation", "Realisation", "Realisation", "Aquisition", "Aquisition", "Aquisition", "Aquisition", "", "", ""}, table.RowConfig{AutoMerge: true})
|
t.AppendHeader(table.Row{"", "", "Realisation", "Realisation", "Realisation", "Realisation", "Acquisition", "Acquisition", "Acquisition", "Acquisition", "", "", ""}, table.RowConfig{AutoMerge: true})
|
||||||
t.AppendHeader(table.Row{"Source Country", "Code", "Year", "Month", "Day", "Value", "Year", "Month", "Day", "Value", "Expenses", "Payed Taxes", "Counter Country"})
|
t.AppendHeader(table.Row{"Source Country", "Code", "Year", "Month", "Day", "Value", "Year", "Month", "Day", "Value", "Expenses", "Paid Taxes", "Counter Country"})
|
||||||
|
|
||||||
return &TableWriter{
|
return &TableWriter{
|
||||||
table: t,
|
table: t,
|
||||||
|
|||||||
@@ -110,9 +110,9 @@ func (rr RecordReader) ReadRecord(_ context.Context) (internal.Record, error) {
|
|||||||
return Record{}, fmt.Errorf("parse record timestamp: %w", err)
|
return Record{}, fmt.Errorf("parse record timestamp: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
convertionFee, err := parseOptinalDecimal(raw[16])
|
conversionFee, err := parseOptinalDecimal(raw[16])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Record{}, fmt.Errorf("parse record convertion fee: %w", err)
|
return Record{}, fmt.Errorf("parse record conversion fee: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
stampDutyTax, err := parseOptinalDecimal(raw[14])
|
stampDutyTax, err := parseOptinalDecimal(raw[14])
|
||||||
@@ -131,7 +131,7 @@ func (rr RecordReader) ReadRecord(_ context.Context) (internal.Record, error) {
|
|||||||
quantity: qant,
|
quantity: qant,
|
||||||
price: price,
|
price: price,
|
||||||
timestamp: ts,
|
timestamp: ts,
|
||||||
fees: convertionFee,
|
fees: conversionFee,
|
||||||
taxes: stampDutyTax.Add(frenchTxTax),
|
taxes: stampDutyTax.Add(frenchTxTax),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func TestRecordReader_ReadRecord(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "well-formed buy",
|
name: "well-formed buy",
|
||||||
r: bytes.NewBufferString(`Market buy,2025-07-03 10:44:29,SYM123456ABXY,ABXY,"Aspargus Brocoli",EOF987654321,2.4387014200,7.3690000000,USD,1.17995999,,"EUR",15.25,"EUR",0.25,"EUR",0.02,"EUR",,`),
|
r: bytes.NewBufferString(`Market buy,2025-07-03 10:44:29,SYM123456ABXY,ABXY,"Aspargus Broccoli",EOF987654321,2.4387014200,7.3690000000,USD,1.17995999,,"EUR",15.25,"EUR",0.25,"EUR",0.02,"EUR",,`),
|
||||||
want: Record{
|
want: Record{
|
||||||
symbol: "SYM123456ABXY",
|
symbol: "SYM123456ABXY",
|
||||||
side: internal.SideBuy,
|
side: internal.SideBuy,
|
||||||
@@ -38,7 +38,7 @@ func TestRecordReader_ReadRecord(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "well-formed sell",
|
name: "well-formed sell",
|
||||||
r: bytes.NewBufferString(`Market sell,2025-08-04 11:45:30,IE000GA3D489,ABXY,"Aspargus Brocoli",EOF987654321,2.4387014200,7.9999999999,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",0.1,"EUR"`),
|
r: bytes.NewBufferString(`Market sell,2025-08-04 11:45:30,IE000GA3D489,ABXY,"Aspargus Broccoli",EOF987654321,2.4387014200,7.9999999999,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",0.1,"EUR"`),
|
||||||
want: Record{
|
want: Record{
|
||||||
symbol: "IE000GA3D489",
|
symbol: "IE000GA3D489",
|
||||||
side: internal.SideSell,
|
side: internal.SideSell,
|
||||||
@@ -51,42 +51,42 @@ func TestRecordReader_ReadRecord(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "malformed side",
|
name: "malformed side",
|
||||||
r: bytes.NewBufferString(`Aljksdaf Balsjdkf,2025-08-04 11:45:39,IE000GA3D489,ABXY,"Aspargus Brocoli",EOF987654321,2.4387014200,7.9999999999,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`),
|
r: bytes.NewBufferString(`Aljksdaf Balsjdkf,2025-08-04 11:45:39,IE000GA3D489,ABXY,"Aspargus Broccoli",EOF987654321,2.4387014200,7.9999999999,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`),
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "empty side",
|
name: "empty side",
|
||||||
r: bytes.NewBufferString(`,2025-08-04 11:45:39,IE000GA3D489,ABXY,"Aspargus Brocoli",EOF987654321,0x1234,7.9999999999,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`),
|
r: bytes.NewBufferString(`,2025-08-04 11:45:39,IE000GA3D489,ABXY,"Aspargus Broccoli",EOF987654321,0x1234,7.9999999999,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`),
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "malformed qantity",
|
name: "malformed qantity",
|
||||||
r: bytes.NewBufferString(`Market sell,2025-08-04 11:45:39,IE000GA3D489,ABXY,"Aspargus Brocoli",EOF987654321,0x1234,7.9999999999,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`),
|
r: bytes.NewBufferString(`Market sell,2025-08-04 11:45:39,IE000GA3D489,ABXY,"Aspargus Broccoli",EOF987654321,0x1234,7.9999999999,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`),
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "empty qantity",
|
name: "empty qantity",
|
||||||
r: bytes.NewBufferString(`Market sell,2025-08-04 11:45:39,IE000GA3D489,ABXY,"Aspargus Brocoli",EOF987654321,,7.9999999999,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`),
|
r: bytes.NewBufferString(`Market sell,2025-08-04 11:45:39,IE000GA3D489,ABXY,"Aspargus Broccoli",EOF987654321,,7.9999999999,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`),
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "malformed price",
|
name: "malformed price",
|
||||||
r: bytes.NewBufferString(`Market sell,2025-08-04 11:45:39,IE000GA3D489,ABXY,"Aspargus Brocoli",EOF987654321,2.4387014200,0b101010,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`),
|
r: bytes.NewBufferString(`Market sell,2025-08-04 11:45:39,IE000GA3D489,ABXY,"Aspargus Broccoli",EOF987654321,2.4387014200,0b101010,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`),
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "empty price",
|
name: "empty price",
|
||||||
r: bytes.NewBufferString(`Market sell,2025-08-04 11:45:39,IE000GA3D489,ABXY,"Aspargus Brocoli",EOF987654321,2.4387014200,,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`),
|
r: bytes.NewBufferString(`Market sell,2025-08-04 11:45:39,IE000GA3D489,ABXY,"Aspargus Broccoli",EOF987654321,2.4387014200,,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`),
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "malformed timestamp",
|
name: "malformed timestamp",
|
||||||
r: bytes.NewBufferString(`Market sell,2006-01-02T15:04:05Z07:00,IE000GA3D489,ABXY,"Aspargus Brocoli",EOF987654321,2.4387014200,7.9999999999,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`),
|
r: bytes.NewBufferString(`Market sell,2006-01-02T15:04:05Z07:00,IE000GA3D489,ABXY,"Aspargus Broccoli",EOF987654321,2.4387014200,7.9999999999,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`),
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "empty timestamp",
|
name: "empty timestamp",
|
||||||
r: bytes.NewBufferString(`Market sell,,IE000GA3D489,ABXY,"Aspargus Brocoli",EOF987654321,2.4387014200,7.9999999999,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`),
|
r: bytes.NewBufferString(`Market sell,,IE000GA3D489,ABXY,"Aspargus Broccoli",EOF987654321,2.4387014200,7.9999999999,USD,1.17995999,,"EUR",15.25,"EUR",,,0.02,"EUR",,`),
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user