@7365admin1/core 3.129.3-staging.587 → 3.129.3-staging.588

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@7365admin1/core",
3
3
  "license": "MIT",
4
- "version": "3.129.3-staging.587",
4
+ "version": "3.129.3-staging.588",
5
5
  "author": "7365admin1",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -138,6 +138,30 @@ describe("nfc patrol log reads are fresh after a write", { concurrency: 1 }, ()
138
138
  }
139
139
  assert.equal(new Set(seen).size, 3);
140
140
  });
141
+
142
+ it("7. the Monthly Report's year query returns that year only (a past year too)", async () => {
143
+ const past = (date) => ({
144
+ _id: new ObjectId(), site: id.site, date,
145
+ route: { _id: id.route.toString(), name: "NPF Route", startTime: "08:00" },
146
+ checkPoints: [], createdAt: new Date(),
147
+ });
148
+ const [jan, dec] = [past("2025-01-01"), past("2025-12-31")];
149
+ await h.db.collection("nfc-patrol-logs").insertMany([jan, dec, past("2024-12-31")]);
150
+
151
+ const year = async (y) => {
152
+ const res = await h.api(
153
+ `/nfc-patrol-log?page=1&limit=100&site=${id.site}&date=${y}&type=month`,
154
+ { sid },
155
+ );
156
+ assert.equal(res.status, 200);
157
+ return res.body.items.map((item) => item.date);
158
+ };
159
+
160
+ assert.deepEqual((await year("2025")).sort(), ["2025-01-01", "2025-12-31"]);
161
+ const current = await year("2026");
162
+ assert.ok(current.length >= 3);
163
+ assert.ok(current.every((date) => date.startsWith("2026-")));
164
+ });
141
165
  });
142
166
 
143
167
  async function seed(h) {