修复配置模型
This commit is contained in:
parent
31b6a8e88d
commit
e0da37cec0
@ -162,7 +162,7 @@ export function parseMultiplierList(value) {
|
||||
.map((item) => Number(item.replace(/x$/i, "")))
|
||||
.filter((item) => Number.isFinite(item) && item >= 0)
|
||||
.map((item) => Math.round(item * ppmScale));
|
||||
const unique = Array.from(new Set([0, ...numbers])).sort((a, b) => a - b);
|
||||
const unique = Array.from(new Set(numbers)).sort((a, b) => a - b);
|
||||
return unique.length > 1 ? unique : [0, 1_000_000];
|
||||
}
|
||||
|
||||
|
||||
@ -15,4 +15,14 @@ describe("lucky gift config payload", () => {
|
||||
test("parses custom multipliers without configured probabilities", () => {
|
||||
expect(parseMultiplierList("0, 0.5x, 1, 2")).toEqual([0, 500_000, 1_000_000, 2_000_000]);
|
||||
});
|
||||
|
||||
test("does not add a losing tier when tester only enters positive multipliers", () => {
|
||||
const payload = payloadFromLuckyGiftForm(
|
||||
{ ...emptyLuckyGiftForm(), multiplierValues: ["1", "2"] },
|
||||
null,
|
||||
);
|
||||
|
||||
expect(payload.multiplier_ppms).toEqual([1_000_000, 2_000_000]);
|
||||
expect(payload.tiers.some((tier) => tier.multiplier_ppm === 0 || tier.reward_coins === 0)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user