aboutsummaryrefslogtreecommitdiff
path: root/modules/test
diff options
context:
space:
mode:
Diffstat (limited to 'modules/test')
-rw-r--r--modules/test/test-memory-graph.js11
-rw-r--r--modules/test/test-webdav-sizes.js1
2 files changed, 10 insertions, 2 deletions
diff --git a/modules/test/test-memory-graph.js b/modules/test/test-memory-graph.js
index d4fe37a..8c3bb6e 100644
--- a/modules/test/test-memory-graph.js
+++ b/modules/test/test-memory-graph.js
@@ -220,8 +220,15 @@ const sessionOf = d => 'session-session-' + Math.floor(new Date(d).getTime() / 8
mg2._edges.every(e => Array.isArray(e.source_agents) && typeof e.weight === 'number'),
JSON.stringify(mg2._edges));
const legFailed = mg2._edges.find(e => e.type === 'failed');
- ok('T6.4 a legacy 0.8 failure is capped below success on load',
- !!legFailed && legFailed.weight < 0.5, 'weight ' + (legFailed || {}).weight);
+ // The cap is applied at READ time, not by rewriting the store: a load must not mutate
+ // user data (the next debounced save would have made it permanent, silently).
+ ok('T6.4a a legacy 0.8 failure is NOT rewritten on load',
+ !!legFailed && legFailed.weight === 0.8, 'stored weight ' + (legFailed || {}).weight);
+ ok('T6.4b it ranks at 0.2 through _effectiveWeight',
+ !!legFailed && mg2._effectiveWeight(legFailed) === 0.2, 'effective ' + (legFailed && mg2._effectiveWeight(legFailed)));
+ ok('T6.4c a success edge keeps its own weight',
+ mg2._effectiveWeight({ type: 'used', weight: 0.5 }) === 0.5,
+ String(mg2._effectiveWeight({ type: 'used', weight: 0.5 })));
ok('T6.5 unrelated legacy weights are untouched',
(mg2._edges.find(e => e.type === 'executed') || {}).weight === 0.6,
String((mg2._edges.find(e => e.type === 'executed') || {}).weight));
diff --git a/modules/test/test-webdav-sizes.js b/modules/test/test-webdav-sizes.js
index 68cb90b..9085f23 100644
--- a/modules/test/test-webdav-sizes.js
+++ b/modules/test/test-webdav-sizes.js
@@ -229,6 +229,7 @@ const said = (out, re) => out.some(o => re.test(o.msg));
// for a 3 GB file) and must not print 'NaN MB' for a missing size.
ok('A14a 2 GiB renders as GB', WebDAVModule.prototype._formatSize.call(null, 2 * 1024 * 1024 * 1024) === '2.0 GB', WebDAVModule.prototype._formatSize.call(null, 2 * 1024 * 1024 * 1024));
ok('A14b undefined does not render NaN', WebDAVModule.prototype._formatSize.call(null, undefined) === '—', WebDAVModule.prototype._formatSize.call(null, undefined));
+ ok('A14d null renders as unknown, not 0 B', WebDAVModule.prototype._formatSize.call(null, null) === '—', WebDAVModule.prototype._formatSize.call(null, null));
ok('A14c 0 bytes is still B', WebDAVModule.prototype._formatSize.call(null, 0) === '0 B', WebDAVModule.prototype._formatSize.call(null, 0));
console.log('test-webdav-sizes: ' + passes + ' passed, ' + fails + ' failed');