mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-25 07:45:44 +00:00
fix perhitunga sapronak
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
repository "gitlab.com/mbugroup/lti-api.git/internal/modules/closings/repositories"
|
||||
)
|
||||
|
||||
func TestBuildSapronakDetailsMapsAdjustmentOutgoingAsUsage(t *testing.T) {
|
||||
res := buildSapronakDetails(
|
||||
map[uint][]repository.SapronakDetailRow{},
|
||||
map[uint][]repository.SapronakDetailRow{},
|
||||
map[uint][]repository.SapronakDetailRow{},
|
||||
map[uint][]repository.SapronakDetailRow{
|
||||
17: {
|
||||
{
|
||||
ProductID: 17,
|
||||
ProductName: "PAKAN GROWING CRUMBLE 8603 MALINDO",
|
||||
Flag: "PAKAN",
|
||||
QtyOut: 9000,
|
||||
Price: 6450,
|
||||
},
|
||||
},
|
||||
},
|
||||
map[uint][]repository.SapronakDetailRow{},
|
||||
map[uint][]repository.SapronakDetailRow{},
|
||||
map[uint][]repository.SapronakDetailRow{},
|
||||
)
|
||||
|
||||
rows := res.AdjOutgoing[17]
|
||||
if len(rows) != 1 {
|
||||
t.Fatalf("expected 1 adjustment outgoing row, got %d", len(rows))
|
||||
}
|
||||
|
||||
row := rows[0]
|
||||
if row.JenisTransaksi != "Pemakaian" {
|
||||
t.Fatalf("expected jenis_transaksi Pemakaian, got %q", row.JenisTransaksi)
|
||||
}
|
||||
if row.QtyKeluar != 9000 {
|
||||
t.Fatalf("expected qty_keluar 9000, got %.3f", row.QtyKeluar)
|
||||
}
|
||||
if row.Nilai != 58050000 {
|
||||
t.Fatalf("expected nilai 58050000, got %.3f", row.Nilai)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user