mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
fix(tests): use fixed timestamp in BWP test for determinism
Replace Date.now() with the pre-captured 'now' variable in the 'set a pill to BWP with infos' test. This prevents timing drift between when test data timestamps are set and when the sandbox is initialized, eliminating flaky failures in CI environments. Refs: BWP-TIME-001, GAP-TEST-001 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -274,6 +274,9 @@ describe('boluswizardpreview', function ( ) {
|
||||
});
|
||||
|
||||
it('set a pill to the BWP with infos', function (done) {
|
||||
// BWP-TIME-001: Use fixed timestamp for deterministic IOB calculation
|
||||
// Using `now` instead of `Date.now()` prevents timing drift between
|
||||
// when data timestamps are set and when sandbox is initialized
|
||||
var ctx = {
|
||||
settings: {}
|
||||
, pluginBase: {
|
||||
@@ -297,7 +300,8 @@ describe('boluswizardpreview', function ( ) {
|
||||
, profile: loadedProfile
|
||||
};
|
||||
|
||||
var sbx = require('../lib/sandbox')().clientInit(ctx, Date.now(), data);
|
||||
// Use `now` (same as data timestamps) instead of Date.now() for determinism
|
||||
var sbx = require('../lib/sandbox')().clientInit(ctx, now, data);
|
||||
|
||||
iob.setProperties(sbx);
|
||||
boluswizardpreview.setProperties(sbx);
|
||||
|
||||
Reference in New Issue
Block a user