fix(rules): review and harden rule-history editing
This commit is contained in:
@@ -230,6 +230,19 @@ describe("rule versions on import", () => {
|
||||
data.posts[0].rules = [{ from: "2026-01", rule: { kind: "everySecondTuesday" } }];
|
||||
expect(() => parseDatasetJson(JSON.stringify(data))).toThrow(/everySecondTuesday/);
|
||||
});
|
||||
|
||||
test.each([
|
||||
["missing percent", { kind: "percentOfIncome" }],
|
||||
["string percent", { kind: "percentOfIncome", percent: "10" }],
|
||||
["null percent", { kind: "percentOfIncome", percent: null }],
|
||||
["missing fixed amount", { kind: "fixed", amount: { currency: "DKK" } }],
|
||||
["string fixed amount", { kind: "fixed", amount: { amount: "500", currency: "DKK" } }],
|
||||
["null fixed amount", { kind: "fixed", amount: { amount: null, currency: "DKK" } }],
|
||||
])("rejects a %s before it can corrupt the fold", (_label, rule) => {
|
||||
const data = populated() as any;
|
||||
data.posts[0].rules = [{ from: "2026-01", rule }];
|
||||
expect(() => parseDatasetJson(JSON.stringify(data))).toThrow(ImportValidationError);
|
||||
});
|
||||
});
|
||||
|
||||
describe("the decimal-places setting on import", () => {
|
||||
|
||||
Reference in New Issue
Block a user