This commit is contained in:
@@ -9,6 +9,7 @@ globalThis.Element = dom.window.Element;
|
||||
globalThis.localStorage = dom.window.localStorage;
|
||||
|
||||
const { CheckboxTree } = await import('../web/vendor/checkbox-tree/checkbox-tree.js');
|
||||
const { findAddressedReleaseNode } = await import('../web/js/tree.js');
|
||||
|
||||
function createTree(options = {}) {
|
||||
const container = document.createElement('div');
|
||||
@@ -103,3 +104,14 @@ test('rejects duplicate node ids', () => {
|
||||
/Duplicate CheckboxTree node id/
|
||||
);
|
||||
});
|
||||
|
||||
test('finds an addressed release leaf by product and exact filename', () => {
|
||||
const nodes = [
|
||||
{ id: 'known', metadata: { path: ['PAN-OS'], addressed: [] } },
|
||||
{ id: 'release', metadata: { path: ['PAN-OS', '11', '11.1'], addressed: ['11.1.13-h3.md'] } },
|
||||
{ id: 'other', metadata: { path: ['GlobalProtect'], addressed: ['11.1.13-h3.md'] } }
|
||||
];
|
||||
|
||||
assert.equal(findAddressedReleaseNode(nodes, 'PAN-OS', '11.1.13-h3')?.id, 'release');
|
||||
assert.equal(findAddressedReleaseNode(nodes, 'PAN-OS', '11.1.13'), undefined);
|
||||
});
|
||||
|
||||
@@ -56,26 +56,12 @@ test('counts unique releases at major and minor levels and hotfixes at patch lev
|
||||
);
|
||||
});
|
||||
|
||||
test('renders the nested levels into a static HTML page', () => {
|
||||
test('renders the graph without displaying the legacy release tables', () => {
|
||||
const html = renderStatisticsPage(buildReleaseStatistics([
|
||||
{ product: 'PAN-OS', issueType: 'addressed', version: '10.1.2-h1' }
|
||||
]));
|
||||
|
||||
assert.match(html, /class="stats-major"/);
|
||||
assert.match(html, /class="stats-minor"[^>]+hidden/);
|
||||
assert.match(html, /class="stats-patch"[^>]+hidden/);
|
||||
assert.match(html, /class="stats-toggle"[^>]+aria-expanded="false"/);
|
||||
assert.match(html, /src="js\/statistics\.js"/);
|
||||
assert.match(html, /id="issue-plot-canvas"/);
|
||||
assert.match(html, />1 hotfix</);
|
||||
});
|
||||
|
||||
test('pluralizes hotfix counts correctly', () => {
|
||||
const html = renderStatisticsPage(buildReleaseStatistics([
|
||||
{ product: 'PAN-OS', issueType: 'addressed', version: '10.1.2-h1' },
|
||||
{ product: 'PAN-OS', issueType: 'addressed', version: '10.1.2-h2' }
|
||||
]));
|
||||
|
||||
assert.match(html, />2 hotfixes</);
|
||||
assert.doesNotMatch(html, /hotfixs/);
|
||||
assert.doesNotMatch(html, /class="stats-product"/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user