ui: fix tests broken by d3-format upgrade
This commit is contained in:
parent
b876b4cad2
commit
2288f33e38
|
@ -66,3 +66,9 @@ export function formatScheduledHertz(hertz, startingUnitSize) {
|
|||
const [number, unit] = reduceHertz(hertz, 'MHz', startingUnitSize);
|
||||
return `${roundFormatter.format(number)} ${unit}`;
|
||||
}
|
||||
|
||||
// Replaces the minus sign (−) with a hyphen (-).
|
||||
// https://github.com/d3/d3-format/releases/tag/v2.0.0
|
||||
export function replaceMinus(input) {
|
||||
return input.replace('−', '-');
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import { setupMirage } from 'ember-cli-mirage/test-support';
|
|||
import a11yAudit from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
import Response from 'ember-cli-mirage/response';
|
||||
import moment from 'moment';
|
||||
import { formatBytes, formatHertz } from 'nomad-ui/utils/units';
|
||||
import { formatBytes, formatHertz, replaceMinus } from 'nomad-ui/utils/units';
|
||||
|
||||
import Optimize from 'nomad-ui/tests/pages/optimize';
|
||||
import Layout from 'nomad-ui/tests/pages/layout';
|
||||
|
@ -153,23 +153,23 @@ module('Acceptance | optimize', function(hooks) {
|
|||
const memDiffPercent = Math.round((100 * memDiff) / currMem);
|
||||
|
||||
assert.equal(
|
||||
summary.cpu,
|
||||
replaceMinus(summary.cpu),
|
||||
cpuDiff ? `${cpuSign}${formatHertz(cpuDiff, 'MHz')} ${cpuSign}${cpuDiffPercent}%` : ''
|
||||
);
|
||||
assert.equal(
|
||||
summary.memory,
|
||||
replaceMinus(summary.memory),
|
||||
memDiff ? `${memSign}${formattedMemDiff(memDiff)} ${memSign}${memDiffPercent}%` : ''
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
summary.aggregateCpu,
|
||||
replaceMinus(summary.aggregateCpu),
|
||||
cpuDiff
|
||||
? `${cpuSign}${formatHertz(cpuDiff * currentTaskGroupAllocations.length, 'MHz')}`
|
||||
: ''
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
summary.aggregateMemory,
|
||||
replaceMinus(summary.aggregateMemory),
|
||||
memDiff ? `${memSign}${formattedMemDiff(memDiff * currentTaskGroupAllocations.length)}` : ''
|
||||
);
|
||||
});
|
||||
|
|
|
@ -113,10 +113,10 @@ module('Integration | Component | das/recommendation-card', function(hooks) {
|
|||
assert.ok(RecommendedMemory.isIncrease);
|
||||
});
|
||||
|
||||
assert.equal(RecommendationCard.totalsTable.unitDiff.cpu, '-75 MHz');
|
||||
assert.equal(RecommendationCard.totalsTable.unitDiff.cpu, '−75 MHz');
|
||||
assert.equal(RecommendationCard.totalsTable.unitDiff.memory, '+128 MiB');
|
||||
|
||||
assert.equal(RecommendationCard.totalsTable.percentDiff.cpu, '-27%');
|
||||
assert.equal(RecommendationCard.totalsTable.percentDiff.cpu, '−27%');
|
||||
assert.equal(RecommendationCard.totalsTable.percentDiff.memory, '+33%');
|
||||
|
||||
assert.equal(RecommendationCard.copyButton.text, 'job-name / group-name');
|
||||
|
|
|
@ -47,7 +47,7 @@ module('Integration | Component | das/recommendation-chart', function(hooks) {
|
|||
assert.dom('.recommendation-chart.decrease').exists();
|
||||
assert.dom('.recommendation-chart .resource').hasText('Mem');
|
||||
assert.dom('.recommendation-chart .icon-is-arrow-down').exists();
|
||||
assert.dom('text.percent').hasText('-32%');
|
||||
assert.dom('text.percent').hasText('−32%');
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue