Add Factor map and Weight to BalanceSummaries

Added additional tests + updated old ones.
This commit is contained in:
ionutboangiu
2024-03-22 14:38:40 -04:00
committed by Dan Christian Bogos
parent 699989a336
commit 6d61fd479d
5 changed files with 88 additions and 4 deletions

View File

@@ -110,23 +110,37 @@ var testEC = &EventCost{
Type: utils.MetaMonetary,
Value: 50,
Initial: 60,
Weight: 20,
Disabled: false,
Factor: ValueFactor{
"factor2": 2,
"factor3": 3,
},
},
{
UUID: "7a54a9e9-d610-4c82-bcb5-a315b9a65010",
ID: "BALANCE_2",
Type: utils.MetaMonetary,
Value: 25,
Weight: 0,
Initial: 60,
Disabled: false,
Factor: ValueFactor{
"factor2": 2,
},
},
{
UUID: "4b8b53d7-c1a1-4159-b845-4623a00a0165",
ID: "BALANCE_3",
Type: utils.MetaVoice,
Value: 200,
Weight: 10,
Initial: 250,
Disabled: true,
Factor: ValueFactor{
"factor4": 4,
"factor5": 5,
},
},
},
AllowNegative: false,
@@ -2526,7 +2540,12 @@ func TestECSyncKeys(t *testing.T) {
Type: utils.MetaMonetary,
Value: 50,
Initial: 60,
Weight: 20,
Disabled: false,
Factor: ValueFactor{
"factor2": 2,
"factor3": 3,
},
},
{
UUID: "7a54a9e9-d610-4c82-bcb5-a315b9a65010",
@@ -2534,7 +2553,11 @@ func TestECSyncKeys(t *testing.T) {
Type: utils.MetaMonetary,
Value: 25,
Initial: 60,
Weight: 0,
Disabled: false,
Factor: ValueFactor{
"factor2": 2,
},
},
{
UUID: "4b8b53d7-c1a1-4159-b845-4623a00a0165",
@@ -2542,7 +2565,12 @@ func TestECSyncKeys(t *testing.T) {
Type: utils.MetaVoice,
Value: 200,
Initial: 250,
Weight: 10,
Disabled: true,
Factor: ValueFactor{
"factor4": 4,
"factor5": 5,
},
},
},
AllowNegative: false,
@@ -3866,6 +3894,21 @@ func TestECAsDataProvider3(t *testing.T) {
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "Balance", "Disabled"},
exp: "true",
},
{
name: "Weight",
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "Balance", "Weight"},
exp: "10",
},
{
name: "Factor map",
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "Balance", "Factor"},
exp: `{"factor4":4,"factor5":5}`,
},
{
name: "Factor value",
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "Balance", "Factor", "factor4"},
exp: "4",
},
{
name: "IncrementCost",
fields: []string{"Charges[0]", "Increments[2]", "Cost"},
@@ -4031,6 +4074,21 @@ func TestECAsDataProvider3(t *testing.T) {
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "ExtraCharge", "Balance", "Disabled"},
exp: "false",
},
{
name: "Weight through ExtraCharge",
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "ExtraCharge", "Balance", "Weight"},
exp: "20",
},
{
name: "Factor map through ExtraCharge",
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "ExtraCharge", "Balance", "Factor"},
exp: `{"factor2":2,"factor3":3}`,
},
{
name: "Factor value through ExtraCharge",
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "ExtraCharge", "Balance", "Factor", "factor3"},
exp: "3",
},
{
name: "AccountID through ExtraCharge",
fields: []string{"Charges[0]", "Increments[3]", "Accounting", "ExtraCharge", "AccountID"},