Skip to content

Commit 7b175af

Browse files
committed
change unit tests to verify that no pricing version default
1 parent c26c0bc commit 7b175af

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

src/packages/util/licenses/purchase/compute-cost.test.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ describe("compute-cost v1 pricing", () => {
3535
);
3636
});
3737

38-
it("computes correct cost when version not given (since version 1 is the default)", () => {
38+
it("computes cost throws error when version not given (defaults are DANGEROUS AND CONFUSING)", () => {
3939
const info = { ...info1 };
4040
// @ts-ignore
4141
delete info["version"];
42-
const cost = compute_cost(info);
43-
expect(decimalMultiply(cost.cost_sub_month, cost.quantity)).toBe(monthly1);
42+
expect(() => {
43+
compute_cost(info);
44+
}).toThrow();
4445
});
4546

4647
it("computes correct cost with a different version of pricing params", () => {
@@ -137,16 +138,6 @@ describe("compute-cost v3 pricing", () => {
137138
);
138139
});
139140

140-
it("version 1 is the default", () => {
141-
const info = { ...info1 };
142-
// @ts-ignore
143-
delete info["version"];
144-
const cost = compute_cost(info);
145-
expect(decimalMultiply(cost.cost_sub_month, cost.quantity)).toBe(
146-
MONTHLY_V1,
147-
);
148-
});
149-
150141
it("computes correct cost with a different version of pricing params", () => {
151142
const info = { ...info1 };
152143
// @ts-ignore

0 commit comments

Comments
 (0)