Skip to content

Commit 6e30ad8

Browse files
author
Michael Recachinas
committed
chore: Run prettier on all js and json files
1 parent b1eee6c commit 6e30ad8

18 files changed

+550
-462
lines changed

Diff for: __tests__/ArrayLayer.test.js

+69-54
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
import React from 'react';
2-
import { expect } from 'chai';
3-
import sinon from 'sinon';
4-
import { configure, mount } from 'enzyme';
5-
import Adapter from 'enzyme-adapter-react-16';
6-
import toJson from 'enzyme-to-json';
7-
import { Plot } from 'sigplot';
8-
import { ArrayLayer } from '../src/index.js';
9-
10-
configure({ adapter: new Adapter() })
11-
12-
window.alert = (msg) => { console.log(msg) };
13-
14-
describe('<ArrayLayer />', () => {
1+
import React from "react";
2+
import { expect } from "chai";
3+
import sinon from "sinon";
4+
import { configure, mount } from "enzyme";
5+
import Adapter from "enzyme-adapter-react-16";
6+
import toJson from "enzyme-to-json";
7+
import { Plot } from "sigplot";
8+
import { ArrayLayer } from "../src/index.js";
9+
10+
configure({ adapter: new Adapter() });
11+
12+
window.alert = (msg) => {
13+
console.log(msg);
14+
};
15+
16+
describe("<ArrayLayer />", () => {
1517
beforeEach(() => {
16-
sinon.spy(Plot.prototype, 'overlay_array');
17-
sinon.spy(Plot.prototype, 'reload');
18-
sinon.spy(Plot.prototype, 'headermod');
18+
sinon.spy(Plot.prototype, "overlay_array");
19+
sinon.spy(Plot.prototype, "reload");
20+
sinon.spy(Plot.prototype, "headermod");
1921
});
2022

2123
afterEach(() => {
@@ -24,58 +26,67 @@ describe('<ArrayLayer />', () => {
2426
Plot.prototype.headermod.restore();
2527
});
2628

27-
it('reloads plot on data prop change', () => {
29+
it("reloads plot on data prop change", () => {
2830
const options = {};
2931
const element = global.document.createElement("div");
3032
const context = { plot: new Plot(element, options) };
3133

3234
let random = [];
3335
for (let i = 0; i <= 1000; i += 1) {
34-
random.push(i * 10);
36+
random.push(i * 10);
3537
}
3638
const oneDimensionalData = random;
3739

38-
const component = mount(
39-
<ArrayLayer data={oneDimensionalData} />,
40-
{ context }
41-
);
40+
const component = mount(<ArrayLayer data={oneDimensionalData} />, {
41+
context,
42+
});
4243

4344
expect(component.props().data).to.equal(oneDimensionalData);
4445
expect(component.instance().plot).to.not.be.undefined;
4546
expect(component.instance().plot._Gx.all).to.equal(false);
4647
expect(component.instance().plot._Gx.expand).to.equal(false);
4748
expect(component.instance().plot._Gx.autol).to.equal(-1);
4849
expect(component.instance().plot._Gx.lyr).to.have.lengthOf(1);
49-
expect(component.instance().plot._Gx.lyr[0].options).to.be.an('object').that.is.empty;
50-
expect(component.instance().plot._Gx.lyr[0].ypoint).to.have.lengthOf(oneDimensionalData.length);
51-
expect(component.instance().plot._Gx.lyr[0].ypoint).to.eql(new Float64Array(oneDimensionalData));
50+
expect(component.instance().plot._Gx.lyr[0].options).to.be.an("object").that
51+
.is.empty;
52+
expect(component.instance().plot._Gx.lyr[0].ypoint).to.have.lengthOf(
53+
oneDimensionalData.length
54+
);
55+
expect(component.instance().plot._Gx.lyr[0].ypoint).to.eql(
56+
new Float64Array(oneDimensionalData)
57+
);
5258

5359
let random2 = [];
5460
for (let i = 0; i <= 1000; i += 1) {
55-
random2.push(i * 10);
61+
random2.push(i * 10);
5662
}
5763
const oneDimensionalData2 = random2;
5864

59-
component.setProps({data: random2});
65+
component.setProps({ data: random2 });
6066
expect(component.props().data).to.equal(oneDimensionalData2);
6167
expect(component.instance().plot).to.not.be.undefined;
6268
expect(component.instance().plot._Gx.all).to.equal(false);
6369
expect(component.instance().plot._Gx.expand).to.equal(false);
6470
expect(component.instance().plot._Gx.autol).to.equal(-1);
6571
expect(component.instance().plot._Gx.lyr).to.have.lengthOf(1);
66-
expect(component.instance().plot._Gx.lyr[0].options).to.be.an('object').that.is.empty;
67-
expect(component.instance().plot._Gx.lyr[0].ypoint).to.have.lengthOf(oneDimensionalData2.length);
68-
expect(component.instance().plot._Gx.lyr[0].ypoint).to.eql(new Float64Array(oneDimensionalData2));
72+
expect(component.instance().plot._Gx.lyr[0].options).to.be.an("object").that
73+
.is.empty;
74+
expect(component.instance().plot._Gx.lyr[0].ypoint).to.have.lengthOf(
75+
oneDimensionalData2.length
76+
);
77+
expect(component.instance().plot._Gx.lyr[0].ypoint).to.eql(
78+
new Float64Array(oneDimensionalData2)
79+
);
6980
});
7081

71-
it('doesn\'t do anything when props change but remain the same', () => {
72-
const options = {framesize: 1000};
82+
it("doesn't do anything when props change but remain the same", () => {
83+
const options = { framesize: 1000 };
7384
const element = global.document.createElement("div");
7485
const context = { plot: new Plot(element, options) };
7586

7687
let random = [];
7788
for (let i = 0; i <= 1000; i += 1) {
78-
random.push(i * 10);
89+
random.push(i * 10);
7990
}
8091
const oneDimensionalData = random;
8192

@@ -90,19 +101,19 @@ describe('<ArrayLayer />', () => {
90101
expect(component.instance().plot._Gx.lyr).to.have.lengthOf(1);
91102
expect(component.instance().plot._Gx.lyr[0].size).to.equal(1000);
92103

93-
component.setProps({layerOptions: options});
104+
component.setProps({ layerOptions: options });
94105
expect(component.props().layerOptions).to.equal(options);
95106
expect(component.instance().plot._Gx.lyr[0].size).to.equal(1000);
96107
});
97108

98-
it('changes layer settings on layerOptions prop change', () => {
99-
const options = {framesize: 1000};
109+
it("changes layer settings on layerOptions prop change", () => {
110+
const options = { framesize: 1000 };
100111
const element = global.document.createElement("div");
101112
const context = { plot: new Plot(element, options) };
102113

103114
let random = [];
104115
for (let i = 0; i <= 1000; i += 1) {
105-
random.push(i * 10);
116+
random.push(i * 10);
106117
}
107118
const oneDimensionalData = random;
108119

@@ -117,21 +128,21 @@ describe('<ArrayLayer />', () => {
117128
expect(component.instance().plot._Gx.lyr).to.have.lengthOf(1);
118129
expect(component.instance().plot._Gx.lyr[0].size).to.equal(1000);
119130

120-
const newOptions = {framesize: 50};
131+
const newOptions = { framesize: 50 };
121132

122-
component.setProps({layerOptions: newOptions});
133+
component.setProps({ layerOptions: newOptions });
123134
expect(component.props().layerOptions).to.equal(newOptions);
124135
expect(component.instance().plot._Gx.lyr[0].size).to.equal(50);
125136
});
126137

127-
it('headermods plot on options prop change', () => {
138+
it("headermods plot on options prop change", () => {
128139
const options = {};
129140
const element = global.document.createElement("div");
130141
const context = { plot: new Plot(element, options) };
131142

132143
let random = [];
133144
for (let i = 0; i <= 1000; i += 1) {
134-
random.push(i * 10);
145+
random.push(i * 10);
135146
}
136147
const oneDimensionalData = random;
137148

@@ -146,21 +157,25 @@ describe('<ArrayLayer />', () => {
146157
expect(component.instance().plot._Gx.expand).to.equal(false);
147158
expect(component.instance().plot._Gx.autol).to.equal(-1);
148159
expect(component.instance().plot._Gx.lyr).to.have.lengthOf(1);
149-
expect(component.instance().plot._Gx.lyr[0].options).to.be.an('object').that.is.empty;
150-
expect(component.instance().plot._Gx.lyr[0].ypoint).to.have.lengthOf(oneDimensionalData.length);
151-
expect(component.instance().plot._Gx.lyr[0].ypoint).to.eql(new Float64Array(oneDimensionalData));
152-
expect(Plot.prototype.overlay_array).to.have.property('callCount', 1);
153-
expect(Plot.prototype.reload).to.have.property('callCount', 0);
154-
expect(Plot.prototype.headermod).to.have.property('callCount', 0);
160+
expect(component.instance().plot._Gx.lyr[0].options).to.be.an("object").that
161+
.is.empty;
162+
expect(component.instance().plot._Gx.lyr[0].ypoint).to.have.lengthOf(
163+
oneDimensionalData.length
164+
);
165+
expect(component.instance().plot._Gx.lyr[0].ypoint).to.eql(
166+
new Float64Array(oneDimensionalData)
167+
);
168+
expect(Plot.prototype.overlay_array).to.have.property("callCount", 1);
169+
expect(Plot.prototype.reload).to.have.property("callCount", 0);
170+
expect(Plot.prototype.headermod).to.have.property("callCount", 0);
155171

156-
const newOptions = {'subsize': 100};
172+
const newOptions = { subsize: 100 };
157173

158-
component.setProps({options: newOptions});
174+
component.setProps({ options: newOptions });
159175
expect(component.props().options.subsize).to.equal(100);
160176
expect(component.instance().plot._Gx.lyr[0].hcb.subsize).to.equal(100);
161-
expect(Plot.prototype.overlay_array).to.have.property('callCount', 1);
162-
expect(Plot.prototype.reload).to.have.property('callCount', 0);
163-
expect(Plot.prototype.headermod).to.have.property('callCount', 1);
177+
expect(Plot.prototype.overlay_array).to.have.property("callCount", 1);
178+
expect(Plot.prototype.reload).to.have.property("callCount", 0);
179+
expect(Plot.prototype.headermod).to.have.property("callCount", 1);
164180
});
165-
166181
});

Diff for: __tests__/HrefLayer.test.js

+48-56
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
import React from 'react';
2-
import { expect } from 'chai';
3-
import sinon from 'sinon';
4-
import { configure, mount } from 'enzyme';
5-
import Adapter from 'enzyme-adapter-react-16';
6-
import toJson from 'enzyme-to-json';
7-
import { Plot } from 'sigplot';
8-
import { HrefLayer } from '../src/index.js';
1+
import React from "react";
2+
import { expect } from "chai";
3+
import sinon from "sinon";
4+
import { configure, mount } from "enzyme";
5+
import Adapter from "enzyme-adapter-react-16";
6+
import toJson from "enzyme-to-json";
7+
import { Plot } from "sigplot";
8+
import { HrefLayer } from "../src/index.js";
99

10-
configure({ adapter: new Adapter() })
10+
configure({ adapter: new Adapter() });
1111

12-
window.alert = (msg) => { console.log(msg) };
12+
window.alert = (msg) => {
13+
console.log(msg);
14+
};
1315

14-
describe('<HrefLayer />', () => {
16+
describe("<HrefLayer />", () => {
1517
beforeEach(() => {
16-
sinon.spy(Plot.prototype, 'deoverlay');
17-
sinon.spy(Plot.prototype, 'overlay_href');
18-
sinon.spy(Plot.prototype, 'change_settings');
18+
sinon.spy(Plot.prototype, "deoverlay");
19+
sinon.spy(Plot.prototype, "overlay_href");
20+
sinon.spy(Plot.prototype, "change_settings");
1921
});
2022

2123
afterEach(() => {
@@ -24,91 +26,81 @@ describe('<HrefLayer />', () => {
2426
Plot.prototype.change_settings.restore();
2527
});
2628

27-
it('reloads plot on href prop change', () => {
29+
it("reloads plot on href prop change", () => {
2830
const element = global.document.createElement("div");
2931
const context = { plot: new Plot(element, {}) };
3032
const hrefOne = "";
31-
const component = mount(
32-
<HrefLayer href={hrefOne} />,
33-
{ context }
34-
);
33+
const component = mount(<HrefLayer href={hrefOne} />, { context });
3534

3635
expect(component.props().href).to.equal(hrefOne);
3736
expect(component.instance().plot).to.not.be.undefined;
38-
expect(Plot.prototype.deoverlay).to.have.property('callCount', 0);
39-
expect(Plot.prototype.overlay_href).to.have.property('callCount', 1);
37+
expect(Plot.prototype.deoverlay).to.have.property("callCount", 0);
38+
expect(Plot.prototype.overlay_href).to.have.property("callCount", 1);
4039
expect(Plot.prototype.overlay_href.getCall(0).args).to.have.length(3);
4140
expect(Plot.prototype.overlay_href.getCall(0).args[0]).to.equal(hrefOne);
4241

4342
const hrefTwo = "dat/penny.prm";
44-
component.setProps({href: hrefTwo});
43+
component.setProps({ href: hrefTwo });
4544
expect(component.props().href).to.equal(hrefTwo);
4645
expect(component.instance().plot).to.not.be.undefined;
47-
expect(Plot.prototype.deoverlay).to.have.property('callCount', 1);
46+
expect(Plot.prototype.deoverlay).to.have.property("callCount", 1);
4847
expect(Plot.prototype.deoverlay.getCall(0).args).to.not.be.empty;
49-
expect(Plot.prototype.overlay_href).to.have.property('callCount', 2);
48+
expect(Plot.prototype.overlay_href).to.have.property("callCount", 2);
5049
expect(Plot.prototype.overlay_href.getCall(1).args).to.have.length(3);
5150
expect(Plot.prototype.overlay_href.getCall(1).args[0]).to.equal(hrefTwo);
5251
});
5352

54-
it('doesn\'t do anything when props change, but stay the same', () => {
53+
it("doesn't do anything when props change, but stay the same", () => {
5554
const element = global.document.createElement("div");
5655
const context = { plot: new Plot(element, {}) };
5756
const hrefOne = "dat/penny.prm";
5857
const options = {};
59-
const component = mount(
60-
<HrefLayer href={hrefOne} options={options} />,
61-
{ context }
62-
);
63-
expect(Plot.prototype.deoverlay).to.have.property('callCount', 0);
64-
expect(Plot.prototype.overlay_href).to.have.property('callCount', 1);
65-
expect(Plot.prototype.change_settings).to.have.property('callCount', 1);
58+
const component = mount(<HrefLayer href={hrefOne} options={options} />, {
59+
context,
60+
});
61+
expect(Plot.prototype.deoverlay).to.have.property("callCount", 0);
62+
expect(Plot.prototype.overlay_href).to.have.property("callCount", 1);
63+
expect(Plot.prototype.change_settings).to.have.property("callCount", 1);
6664

67-
component.setProps({href: hrefOne, options: options});
68-
expect(Plot.prototype.deoverlay).to.have.property('callCount', 0);
69-
expect(Plot.prototype.overlay_href).to.have.property('callCount', 1);
70-
expect(Plot.prototype.change_settings).to.have.property('callCount', 1);
65+
component.setProps({ href: hrefOne, options: options });
66+
expect(Plot.prototype.deoverlay).to.have.property("callCount", 0);
67+
expect(Plot.prototype.overlay_href).to.have.property("callCount", 1);
68+
expect(Plot.prototype.change_settings).to.have.property("callCount", 1);
7169
});
7270

73-
it('changes settings on options prop change', () => {
71+
it("changes settings on options prop change", () => {
7472
const element = global.document.createElement("div");
7573
const context = { plot: new Plot(element, {}) };
7674
const hrefOne = "dat/penny.prm";
7775

78-
sinon.spy(Plot.prototype, 'overlay_bluefile');
76+
sinon.spy(Plot.prototype, "overlay_bluefile");
7977

80-
const component = mount(
81-
<HrefLayer href={hrefOne} />,
82-
{ context }
83-
);
78+
const component = mount(<HrefLayer href={hrefOne} />, { context });
8479

8580
expect(component.props().href).to.equal(hrefOne);
8681
expect(component.instance().plot).to.not.be.undefined;
87-
expect(Plot.prototype.overlay_bluefile).to.have.property('callCount', 1);
82+
expect(Plot.prototype.overlay_bluefile).to.have.property("callCount", 1);
8883
expect(component.instance().layer).to.equal(0);
89-
expect(Plot.prototype.deoverlay).to.have.property('callCount', 0);
90-
expect(Plot.prototype.overlay_href).to.have.property('callCount', 1);
84+
expect(Plot.prototype.deoverlay).to.have.property("callCount", 0);
85+
expect(Plot.prototype.overlay_href).to.have.property("callCount", 1);
9186
expect(Plot.prototype.overlay_href.getCall(0).args).to.have.length(3);
9287
expect(Plot.prototype.overlay_href.getCall(0).args[0]).to.equal(hrefOne);
9388
expect(component.instance().plot._Gx.lyr).to.have.lengthOf(1);
94-
expect(component.instance().plot._Gx.lyr[0].drawmode)
95-
.to
96-
.be
97-
.undefined;
89+
expect(component.instance().plot._Gx.lyr[0].drawmode).to.be.undefined;
9890

9991
const options = {
100-
drawmode: 'righttoleft'
92+
drawmode: "righttoleft",
10193
};
102-
component.setProps({options: options});
94+
component.setProps({ options: options });
10395
expect(component.props().href).to.equal(hrefOne);
10496
expect(component.instance().plot).to.not.be.undefined;
105-
expect(Plot.prototype.deoverlay).to.have.property('callCount', 0);
106-
expect(Plot.prototype.overlay_href).to.have.property('callCount', 1);
97+
expect(Plot.prototype.deoverlay).to.have.property("callCount", 0);
98+
expect(Plot.prototype.overlay_href).to.have.property("callCount", 1);
10799
expect(Plot.prototype.overlay_href.getCall(0).args).to.have.length(3);
108100
expect(Plot.prototype.overlay_href.getCall(0).args[0]).to.equal(hrefOne);
109101
expect(component.instance().plot._Gx.lyr).to.have.lengthOf(1);
110-
expect(component.instance().plot._Gx.lyr[0].drawmode)
111-
.to
112-
.equal(options.drawmode);
102+
expect(component.instance().plot._Gx.lyr[0].drawmode).to.equal(
103+
options.drawmode
104+
);
113105
});
114106
});

0 commit comments

Comments
 (0)