@remit/backend 0.0.69 → 0.0.70

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/backend",
3
- "version": "0.0.69",
3
+ "version": "0.0.70",
4
4
  "description": "Remit Mail Inspector API backend",
5
5
  "license": "MIT",
6
6
  "author": "",
@@ -341,4 +341,26 @@ describe("POST /system/update", () => {
341
341
  assert.ok(!(forbidden in request));
342
342
  }
343
343
  });
344
+
345
+ it("stamps requestedAt with the moment of the request, in UTC", async () => {
346
+ // The updater installs a request only while it is still current (#587), so
347
+ // requestedAt is the field that decides it. A missing, fixed or non-UTC
348
+ // stamp would make every request expire on arrival.
349
+ writeState(okState);
350
+ const before = Date.now();
351
+
352
+ await applyUpdate("v1.5.0", buildEvent(USER));
353
+
354
+ const after = Date.now();
355
+ const request = JSON.parse(
356
+ readFileSync(join(controlDir, "request.json"), "utf8"),
357
+ ) as { requestedAt: string };
358
+
359
+ assert.match(
360
+ request.requestedAt,
361
+ /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/,
362
+ );
363
+ const stamped = Date.parse(request.requestedAt);
364
+ assert.ok(stamped >= before - 1000 && stamped <= after + 1000);
365
+ });
344
366
  });