mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-07-26 09:05:07 +02:00
chore(gh): fix tests
This commit is contained in:
@@ -64,7 +64,7 @@ test('throws when filtering leaves fewer than two heap snapshots per side', asyn
|
||||
})).toThrow('At least two samples per side are required');
|
||||
});
|
||||
|
||||
test('reports the difference of medians and leaves a paired-looking PSS delta uncoloured', async () => {
|
||||
test('omits a paired-looking PSS delta that stays within observed noise', async () => {
|
||||
const base = replacePssSamples(await loadFixture('base'), [290_000, 292_900, 295_800, 298_700, 301_600]);
|
||||
const head = replacePssSamples(await loadFixture('head'), [292_900, 296_300, 298_700, 301_600, 290_000]);
|
||||
|
||||
@@ -78,16 +78,10 @@ test('reports the difference of medians and leaves a paired-looking PSS delta un
|
||||
baseHeapSnapshotUrl: 'https://example.invalid/base',
|
||||
headHeapSnapshotUrl: 'https://example.invalid/head',
|
||||
});
|
||||
const row = findMetricRow(markdown, 'PSS');
|
||||
|
||||
expect(row).toContain('295.8 MB <br> ± 2.9 MB');
|
||||
expect(row).toContain('296.3 MB <br> ± 3.4 MB');
|
||||
expect(row).toContain('$\\text{+0.5 MB}$');
|
||||
expect(row).toContain('4.5 MB');
|
||||
expect(row.split('|')).toHaveLength(7);
|
||||
expect(row).not.toMatch(/within noise|increase|decrease|inconclusive/);
|
||||
expect(row).not.toContain('\\color{orange}');
|
||||
expect(findMetricRow(markdown, 'USS')).not.toContain('\\color{orange}');
|
||||
expect(markdown).not.toContain('| **PSS** |');
|
||||
expect(markdown).toContain('<small><i>Only metrics showing significant changes are displayed.</i></small>');
|
||||
expect(markdown).not.toContain('⚠️ **Warning**: Memory usage (PSS)');
|
||||
});
|
||||
|
||||
test('keeps the convergence warning without suppressing table colour or the PSS warning', async () => {
|
||||
|
||||
@@ -251,7 +251,7 @@ test('renders a directional encoded byte delta at the absolute threshold', async
|
||||
|
||||
const row = requireMetricRow(await renderReport(null, { base, head }), 'Encoded network');
|
||||
|
||||
expect(row).toContain('$\\color{orange}{\\text{+10 KB}}$');
|
||||
expect(row).toContain('$\\color{orange}{\\text{+10 KB}}$');
|
||||
});
|
||||
|
||||
test('colours absolute and relative deltas together when the row is significant', async () => {
|
||||
@@ -268,9 +268,9 @@ test('colours absolute and relative deltas together when the row is significant'
|
||||
|
||||
const row = requireMetricRow(await renderReport(null, { base, head }), 'Encoded network');
|
||||
|
||||
expect(row).toContain('100 MB <br> ± 0 B');
|
||||
expect(row).toContain('$\\color{orange}{\\text{+20 KB}}$<br>$\\color{orange}{\\text{+0\\\\%}}$');
|
||||
expect(row).toContain('| 0 B |');
|
||||
expect(row).toContain('100 MB <br> ± 0 B');
|
||||
expect(row).toContain('$\\color{orange}{\\text{+20 KB}}$<br>$\\color{orange}{\\text{+0\\\\%}}$');
|
||||
expect(row).toContain('| 0 B |');
|
||||
expect(row.split('|')).toHaveLength(7);
|
||||
});
|
||||
|
||||
|
||||
@@ -20,15 +20,15 @@ import {
|
||||
describe('formatBytes', () => {
|
||||
// 1024ではなく1000区切り。単位が2桁以上なら小数を落とす
|
||||
test.each([
|
||||
[0, '0 B'],
|
||||
[999, '999 B'],
|
||||
[1_000, '1 KB'],
|
||||
[1_500, '1.5 KB'],
|
||||
[15_000, '15 KB'],
|
||||
[1_234_567, '1.2 MB'],
|
||||
[12_345_678, '12 MB'],
|
||||
[1_500_000_000, '1.5 GB'],
|
||||
[1_500_000_000_000, '1,500 GB'],
|
||||
[0, '0 B'],
|
||||
[999, '999 B'],
|
||||
[1_000, '1 KB'],
|
||||
[1_500, '1.5 KB'],
|
||||
[15_000, '15 KB'],
|
||||
[1_234_567, '1.2 MB'],
|
||||
[12_345_678, '12 MB'],
|
||||
[1_500_000_000, '1.5 GB'],
|
||||
[1_500_000_000_000, '1,500 GB'],
|
||||
])('formats %i as %s', (input, expected) => {
|
||||
expect(formatBytes(input)).toBe(expected);
|
||||
});
|
||||
|
||||
@@ -45,7 +45,7 @@ describe('renderHeapSnapshotTable', () => {
|
||||
report([1_100_000, 1_200_000, 1_300_000]),
|
||||
));
|
||||
|
||||
expect(row).toContain('$\\text{+100 KB}$');
|
||||
expect(row).toContain('$\\text{+100 KB}$');
|
||||
expect(row).not.toContain('within noise');
|
||||
expect(row).not.toContain('\\color{orange}');
|
||||
});
|
||||
@@ -56,7 +56,7 @@ describe('renderHeapSnapshotTable', () => {
|
||||
report([1_200_000, 1_200_000, 1_200_000]),
|
||||
));
|
||||
|
||||
expect(row).toContain('$\\color{orange}{\\text{+200 KB}}$');
|
||||
expect(row).toContain('$\\color{orange}{\\text{+200 KB}}$');
|
||||
expect(row).toContain('$\\color{orange}{\\text{+20\\\\%}}$');
|
||||
expect(row).not.toContain('increase');
|
||||
});
|
||||
@@ -67,7 +67,7 @@ describe('renderHeapSnapshotTable', () => {
|
||||
report([1_050_000, 1_050_000, 1_050_000]),
|
||||
));
|
||||
|
||||
expect(row).toContain('$\\text{+50 KB}$<br>$\\text{+5\\\\%}$');
|
||||
expect(row).toContain('$\\text{+50 KB}$<br>$\\text{+5\\\\%}$');
|
||||
expect(row.split('|')[4]).not.toContain('\\color{');
|
||||
});
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ describe('renderMetricComparisonTable', () => {
|
||||
expect(table.split('\n')).toStrictEqual([
|
||||
'| Metric | @ Base | @ Head | Δ | MAD |',
|
||||
'| --- | ---: | ---: | ---: | ---: |',
|
||||
'| <strong>Metric</strong> | 100 units <br> ± 0 units | 120 units <br> ± 0 units | $\\color{orange}{\\text{+20 units}}$<br>$\\color{orange}{\\text{+20\\\\%}}$ | 0 units |',
|
||||
'| <strong>Metric</strong> | 100 units <br> ± 0 units | 120 units <br> ± 0 units | $\\color{orange}{\\text{+20~units}}$<br>$\\color{orange}{\\text{+20\\\\%}}$ | 0 units |',
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ describe('renderMetricComparisonTable', () => {
|
||||
expect(table.split('\n')).toStrictEqual([
|
||||
'| Metric | @ Base | @ Head | Δ | MAD |',
|
||||
'| --- | ---: | ---: | ---: | ---: |',
|
||||
'| <strong>Metric</strong> | 100 units | 120 units | $\\color{orange}{\\text{+20 units}}$ | 0 units |',
|
||||
'| <strong>Metric</strong> | 100 units | 120 units | $\\color{orange}{\\text{+20~units}}$ | 0 units |',
|
||||
'| | | | | |',
|
||||
]);
|
||||
});
|
||||
@@ -62,7 +62,7 @@ describe('renderMetricComparisonTable', () => {
|
||||
const head = samples(109, 109, 109);
|
||||
const table = renderMetricComparisonTable(base, head, [defaultRow]);
|
||||
|
||||
expect(table).toContain('$\\text{+9 units}$<br>$\\text{+9\\\\%}$');
|
||||
expect(table).toContain('$\\text{+9~units}$<br>$\\text{+9\\\\%}$');
|
||||
expect(table).not.toContain('\\color{');
|
||||
expect(renderMetricComparisonTable(base, head, [defaultRow], {
|
||||
onlySignificantChanges: true,
|
||||
@@ -85,7 +85,7 @@ describe('renderMetricComparisonTable', () => {
|
||||
{ onlySignificantChanges: true },
|
||||
);
|
||||
|
||||
expect(table).toContain('$\\color{orange}{\\text{+10 units}}$');
|
||||
expect(table).toContain('$\\color{orange}{\\text{+10~units}}$');
|
||||
expect(table).toContain('$\\color{orange}{\\text{+10\\\\%}}$');
|
||||
});
|
||||
|
||||
@@ -106,11 +106,11 @@ describe('renderMetricComparisonTable', () => {
|
||||
[defaultRow],
|
||||
);
|
||||
|
||||
expect(inside).toContain('$\\text{+9 units}$');
|
||||
expect(inside).toContain('$\\text{+9~units}$');
|
||||
expect(inside).not.toContain('\\color{');
|
||||
expect(boundary).toContain('$\\text{+30 units}$');
|
||||
expect(boundary).toContain('$\\text{+30~units}$');
|
||||
expect(boundary).not.toContain('\\color{');
|
||||
expect(outside).toContain('$\\color{orange}{\\text{+31 units}}$');
|
||||
expect(outside).toContain('$\\color{orange}{\\text{+31~units}}$');
|
||||
expect(outside).toContain('$\\color{orange}{\\text{+31\\\\%}}$');
|
||||
});
|
||||
|
||||
@@ -121,7 +121,7 @@ describe('renderMetricComparisonTable', () => {
|
||||
[defaultRow],
|
||||
);
|
||||
|
||||
expect(table).toContain('$\\color{green}{\\text{-20 units}}$');
|
||||
expect(table).toContain('$\\color{green}{\\text{-20~units}}$');
|
||||
expect(table).toContain('$\\color{green}{\\text{-16.7\\\\%}}$');
|
||||
});
|
||||
|
||||
@@ -132,7 +132,7 @@ describe('renderMetricComparisonTable', () => {
|
||||
[defaultRow],
|
||||
);
|
||||
|
||||
expect(table).toContain('$\\color{orange}{\\text{+20 units}}$<br>-');
|
||||
expect(table).toContain('$\\color{orange}{\\text{+20~units}}$<br>-');
|
||||
});
|
||||
|
||||
test('propagates the minimum sample contract', () => {
|
||||
|
||||
Reference in New Issue
Block a user