(t *testing.T)
| 877 | } |
| 878 | |
| 879 | func TestLineageE2E_DebitFlow_ToLineageEnabledBalance(t *testing.T) { |
| 880 | ctx := context.Background() |
| 881 | mockDS := new(mocks.MockDataSource) |
| 882 | |
| 883 | aliceIdentity := &model.Identity{ |
| 884 | IdentityID: "idt_alice_123", |
| 885 | FirstName: "Alice", |
| 886 | LastName: "Smith", |
| 887 | } |
| 888 | |
| 889 | bobIdentity := &model.Identity{ |
| 890 | IdentityID: "idt_bob_456", |
| 891 | FirstName: "Bob", |
| 892 | LastName: "Jones", |
| 893 | } |
| 894 | |
| 895 | aliceMainBalance := &model.Balance{ |
| 896 | BalanceID: "bln_alice_main", |
| 897 | IdentityID: "idt_alice_123", |
| 898 | Currency: "USD", |
| 899 | Balance: big.NewInt(10000), |
| 900 | TrackFundLineage: true, |
| 901 | AllocationStrategy: "FIFO", |
| 902 | } |
| 903 | |
| 904 | bobMainBalance := &model.Balance{ |
| 905 | BalanceID: "bln_bob_main", |
| 906 | IdentityID: "idt_bob_456", |
| 907 | Currency: "USD", |
| 908 | Balance: big.NewInt(0), |
| 909 | TrackFundLineage: true, |
| 910 | AllocationStrategy: "FIFO", |
| 911 | } |
| 912 | |
| 913 | aliceStripeMapping := model.LineageMapping{ |
| 914 | BalanceID: "bln_alice_main", |
| 915 | Provider: "stripe", |
| 916 | ShadowBalanceID: "bln_stripe_alice_shadow", |
| 917 | AggregateBalanceID: "bln_alice_aggregate", |
| 918 | CreatedAt: time.Date(2024, 1, 1, 10, 0, 0, 0, time.UTC), |
| 919 | } |
| 920 | |
| 921 | mockDS.On("GetBalanceByID", "bln_alice_main", mock.Anything, mock.Anything).Return(aliceMainBalance, nil) |
| 922 | mockDS.On("GetBalanceByID", "bln_bob_main", mock.Anything, mock.Anything).Return(bobMainBalance, nil) |
| 923 | mockDS.On("GetIdentityByID", "idt_alice_123").Return(aliceIdentity, nil) |
| 924 | mockDS.On("GetIdentityByID", "idt_bob_456").Return(bobIdentity, nil) |
| 925 | mockDS.On("GetLineageMappings", mock.Anything, "bln_alice_main").Return([]model.LineageMapping{aliceStripeMapping}, nil) |
| 926 | mockDS.On("GetBalanceByIDLite", mock.Anything).Return(&model.Balance{ |
| 927 | DebitBalance: big.NewInt(5000), |
| 928 | CreditBalance: big.NewInt(0), |
| 929 | }, nil) |
| 930 | mockDS.On("GetBalanceByIndicator", mock.Anything, mock.Anything).Return(&model.Balance{ |
| 931 | BalanceID: "bln_new_shadow", |
| 932 | }, nil) |
| 933 | mockDS.On("UpsertLineageMapping", mock.Anything, mock.Anything).Return(nil) |
| 934 | |
| 935 | ledgerforgeInstance := &LedgerForge{datasource: mockDS} |
| 936 |
nothing calls this directly
no test coverage detected