Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+85
@@ -0,0 +1,85 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { calculateStorageCapacity, STORAGE_BYTES_PER_GB } from "./storage-capacity.js";
|
||||
|
||||
describe("calculateStorageCapacity", () => {
|
||||
it("combines base, extra-seat, and recurring add-on storage", () => {
|
||||
expect(
|
||||
calculateStorageCapacity({
|
||||
planCode: "starter",
|
||||
officeSeatQuantity: 4,
|
||||
fieldSeatQuantity: 6,
|
||||
storageAddOnCodes: ["storage_100gb", "storage_500gb"],
|
||||
}),
|
||||
).toEqual({
|
||||
planCode: "starter",
|
||||
includedStorageGb: 100,
|
||||
additionalSeatStorageGb: 30,
|
||||
addOnStorageGb: 600,
|
||||
totalStorageGb: 730,
|
||||
totalStorageBytes: 730 * STORAGE_BYTES_PER_GB,
|
||||
});
|
||||
});
|
||||
|
||||
it("does not grant extra storage for seats already included in the package", () => {
|
||||
expect(
|
||||
calculateStorageCapacity({
|
||||
planCode: "pro",
|
||||
officeSeatQuantity: 5,
|
||||
fieldSeatQuantity: 15,
|
||||
}),
|
||||
).toMatchObject({
|
||||
includedStorageGb: 500,
|
||||
additionalSeatStorageGb: 0,
|
||||
addOnStorageGb: 0,
|
||||
totalStorageGb: 500,
|
||||
});
|
||||
});
|
||||
|
||||
it("grows the shared pool with every additional paid license at the plan rate", () => {
|
||||
expect(
|
||||
calculateStorageCapacity({
|
||||
planCode: "pro",
|
||||
officeSeatQuantity: 6,
|
||||
fieldSeatQuantity: 16,
|
||||
}),
|
||||
).toMatchObject({
|
||||
includedStorageGb: 500,
|
||||
additionalSeatStorageGb: 40,
|
||||
totalStorageGb: 540,
|
||||
});
|
||||
expect(
|
||||
calculateStorageCapacity({
|
||||
planCode: "business",
|
||||
officeSeatQuantity: 11,
|
||||
fieldSeatQuantity: 31,
|
||||
}),
|
||||
).toMatchObject({
|
||||
includedStorageGb: 2_000,
|
||||
additionalSeatStorageGb: 80,
|
||||
totalStorageGb: 2_080,
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects unknown plans, add-ons, and duplicate add-ons", () => {
|
||||
expect(() =>
|
||||
calculateStorageCapacity({ planCode: "unknown", officeSeatQuantity: 1, fieldSeatQuantity: 0 }),
|
||||
).toThrow("Unknown billing plan");
|
||||
expect(() =>
|
||||
calculateStorageCapacity({
|
||||
planCode: "starter",
|
||||
officeSeatQuantity: 1,
|
||||
fieldSeatQuantity: 0,
|
||||
storageAddOnCodes: ["storage_unknown"],
|
||||
}),
|
||||
).toThrow("Unknown storage add-on");
|
||||
expect(() =>
|
||||
calculateStorageCapacity({
|
||||
planCode: "starter",
|
||||
officeSeatQuantity: 1,
|
||||
fieldSeatQuantity: 0,
|
||||
storageAddOnCodes: ["storage_100gb", "storage_100gb"],
|
||||
}),
|
||||
).toThrow("must be unique");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user