Commit 5749489e by deep-42-thought Committed by Torkel Ödegaard

public/app/plugins/panel/graph/specs/graph_specs.ts: relax tests to be "within"…

public/app/plugins/panel/graph/specs/graph_specs.ts: relax tests to be "within" instead of "equal", so they won't fail on i686 (#9286)
parent d0ddf767
......@@ -133,12 +133,16 @@ describe('grafanaGraph', function() {
it('should apply axis transform, autoscaling (if necessary) and ticks', function() {
var axisAutoscale = ctx.plotOptions.yaxes[0];
expect(axisAutoscale.transform(100)).to.be(2);
expect(axisAutoscale.inverseTransform(-3)).to.be(0.001);
expect(axisAutoscale.min).to.be(0.001);
expect(axisAutoscale.inverseTransform(-3)).to.within(0.00099999999,0.00100000001);
expect(axisAutoscale.min).to.within(0.00099999999,0.00100000001);
expect(axisAutoscale.max).to.be(10000);
expect(axisAutoscale.ticks.length).to.be(8);
expect(axisAutoscale.ticks[0]).to.be(0.001);
expect(axisAutoscale.ticks[7]).to.be(10000);
expect(axisAutoscale.ticks.length).to.within(7,8);
expect(axisAutoscale.ticks[0]).to.within(0.00099999999,0.00100000001);
if (axisAutoscale.ticks.length === 7) {
expect(axisAutoscale.ticks[axisAutoscale.ticks.length-1]).to.within(999.9999,1000.0001);
} else {
expect(axisAutoscale.ticks[axisAutoscale.ticks.length-1]).to.be(10000);
}
var axisFixedscale = ctx.plotOptions.yaxes[1];
expect(axisFixedscale.min).to.be(0.05);
......@@ -162,7 +166,7 @@ describe('grafanaGraph', function() {
it('should not set min and max and should create some fake ticks', function() {
var axisAutoscale = ctx.plotOptions.yaxes[0];
expect(axisAutoscale.transform(100)).to.be(2);
expect(axisAutoscale.inverseTransform(-3)).to.be(0.001);
expect(axisAutoscale.inverseTransform(-3)).to.within(0.00099999999,0.00100000001);
expect(axisAutoscale.min).to.be(undefined);
expect(axisAutoscale.max).to.be(undefined);
expect(axisAutoscale.ticks.length).to.be(2);
......@@ -187,7 +191,7 @@ describe('grafanaGraph', function() {
it('should set min to 0.1 and add a tick for 0.1', function() {
var axisAutoscale = ctx.plotOptions.yaxes[0];
expect(axisAutoscale.transform(100)).to.be(2);
expect(axisAutoscale.inverseTransform(-3)).to.be(0.001);
expect(axisAutoscale.inverseTransform(-3)).to.within(0.00099999999,0.00100000001);
expect(axisAutoscale.min).to.be(0.1);
expect(axisAutoscale.max).to.be(10000);
expect(axisAutoscale.ticks.length).to.be(6);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment