@7365admin1/core 3.122.6 → 3.124.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.ts +100 -2
- package/dist/index.js +42 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/console-audit.test.mjs +8 -0
- package/test/e2e/dashboard-inventory-low-stock.e2e.test.mjs +40 -1
package/package.json
CHANGED
|
@@ -361,3 +361,11 @@ test("the row keeps ids, and names are joined at read time", () => {
|
|
|
361
361
|
test("a date filter reads the whole of the day it names", () => {
|
|
362
362
|
assert.match(CONTROLLER, /T23:59:59\.999Z/);
|
|
363
363
|
});
|
|
364
|
+
|
|
365
|
+
test("inventory store-type repair: its row keeps only the type and the store name", async () => {
|
|
366
|
+
const { ConsoleAuditAction, pickAuditFields, CONSOLE_AUDIT_LABELS } = await import("./.build/utils/console-audit.util.mjs");
|
|
367
|
+
const action = ConsoleAuditAction.INVENTORY_STORE_TYPE_REPAIRED;
|
|
368
|
+
assert.equal(action, "inventory.store-type-repaired");
|
|
369
|
+
assert.ok(CONSOLE_AUDIT_LABELS[action]);
|
|
370
|
+
assert.deepEqual(pickAuditFields(action, { ownerType: "service_provider", name: "Main Store", createdBy: "x", email: "a@b.c" }), { ownerType: "service_provider", name: "Main Store" });
|
|
371
|
+
});
|
|
@@ -18,7 +18,26 @@ describe("dashboard supply tile", { concurrency: 1 }, () => {
|
|
|
18
18
|
before(async () => {
|
|
19
19
|
h = await startHarness();
|
|
20
20
|
const store = new ObjectId();
|
|
21
|
-
|
|
21
|
+
const cleaner = new ObjectId();
|
|
22
|
+
const guards = new ObjectId();
|
|
23
|
+
const manager = new ObjectId();
|
|
24
|
+
await h.db.collection("organizations").insertMany([
|
|
25
|
+
{ _id: cleaner, name: "Cleaner", nature: "cleaning_services" },
|
|
26
|
+
{ _id: guards, name: "Guards", nature: "security_agency" },
|
|
27
|
+
{ _id: manager, name: "Manager", nature: "property_management_agency" },
|
|
28
|
+
]);
|
|
29
|
+
await h.db.collection("inventory.stores").insertOne({ _id: store, org: cleaner, ownerType: "service_provider", name: "Main", sites: [withStore], status: "active" });
|
|
30
|
+
// Two more organisations keep their own stores at the same site.
|
|
31
|
+
const guardStore = new ObjectId();
|
|
32
|
+
const propertyStore = new ObjectId();
|
|
33
|
+
await h.db.collection("inventory.stores").insertMany([
|
|
34
|
+
{ _id: guardStore, org: guards, ownerType: "service_provider", name: "Guard room", sites: [withStore], status: "active" },
|
|
35
|
+
{ _id: propertyStore, org: manager, ownerType: "property", name: "Property store", sites: [withStore], status: "active" },
|
|
36
|
+
]);
|
|
37
|
+
await h.db.collection("inventory.items").insertMany([
|
|
38
|
+
{ store: guardStore, name: "Guard torch battery", onHand: 1, reorderLevel: 5, status: "active" },
|
|
39
|
+
{ store: propertyStore, name: "Property LED", onHand: 2, reorderLevel: 10, status: "active" },
|
|
40
|
+
]);
|
|
22
41
|
await h.db.collection("inventory.items").insertMany([
|
|
23
42
|
{ store, name: "Tube 18W", onHand: 3, reorderLevel: 10, status: "active" },
|
|
24
43
|
{ store, name: "Holder", onHand: 0, reorderLevel: 5, status: "active" },
|
|
@@ -50,6 +69,26 @@ describe("dashboard supply tile", { concurrency: 1 }, () => {
|
|
|
50
69
|
assert.equal(supply.thresholdUnavailableReason, undefined);
|
|
51
70
|
});
|
|
52
71
|
|
|
72
|
+
it("another organisation's store at the same site never appears on this app's tile", async () => {
|
|
73
|
+
const supply = await tile(withStore);
|
|
74
|
+
assert.ok(!supply.items.some((i) => i.name === "Guard torch battery" || i.name === "Property LED"));
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("the property and security dashboards show Low Stock from their own organisation's store only", async () => {
|
|
78
|
+
const repo = h.core.useNewDashboardRepo();
|
|
79
|
+
const pm = await repo.getPropertyManagementDashboard(withStore.toString());
|
|
80
|
+
assert.equal(pm.supplyAlert.basis, "below-alert-level");
|
|
81
|
+
assert.deepEqual(pm.supplyAlert.items, [{ name: "Property LED", qty: 2 }]);
|
|
82
|
+
const sec = await repo.getSecurityDashboard({ siteId: withStore.toString() });
|
|
83
|
+
assert.deepEqual(sec.supplyAlert.items, [{ name: "Guard torch battery", qty: 1 }]);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("the property and security dashboards carry no supply tile where they have no store", async () => {
|
|
87
|
+
const repo = h.core.useNewDashboardRepo();
|
|
88
|
+
assert.equal((await repo.getPropertyManagementDashboard(withoutStore.toString())).supplyAlert, undefined);
|
|
89
|
+
assert.equal((await repo.getSecurityDashboard({ siteId: withoutStore.toString() })).supplyAlert, undefined);
|
|
90
|
+
});
|
|
91
|
+
|
|
53
92
|
it("a site without a store keeps the old lowest-quantity list", async () => {
|
|
54
93
|
const supply = await tile(withoutStore);
|
|
55
94
|
assert.equal(supply.basis, "lowest-quantity");
|