Skip to content

Commit 3265808

Browse files
authored
Removing var keyword from test code (#604)
1 parent ae8867a commit 3265808

16 files changed

+92
-92
lines changed

test/tests/p5.Amplitude.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
var expect = chai.expect;
1+
const expect = chai.expect;
22

33
describe('p5.Amplitude', function () {
44
this.timeout(1000);
55

6-
var sf, amp, osc, oAmp;
6+
let sf, amp, osc, oAmp;
77

88
it('can be created', function () {
99
amp = new p5.Amplitude();

test/tests/p5.AudioIn.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
var expect = chai.expect;
1+
const expect = chai.expect;
22

33
describe('p5.AudioIn', function () {
44
it('can be created and disposed', function () {
5-
var mic = new p5.AudioIn();
5+
const mic = new p5.AudioIn();
66
mic.dispose();
77
});
88

99
it('can be started and stopped', function () {
10-
var mic = new p5.AudioIn();
10+
const mic = new p5.AudioIn();
1111
mic.start(function () {
1212
mic.stop();
1313
});
1414
});
1515

1616
it('can get sources', function (done) {
17-
var mic = new p5.AudioIn();
17+
const mic = new p5.AudioIn();
1818
mic.getSources().then(function (sources) {
1919
console.log(sources);
2020
expect(sources).to.be.an('array');
@@ -23,7 +23,7 @@ describe('p5.AudioIn', function () {
2323
});
2424

2525
it('can set source', function (done) {
26-
var mic = new p5.AudioIn();
26+
const mic = new p5.AudioIn();
2727
expect(mic.currentSource).to.be.null;
2828

2929
return mic.getSources().then(function () {

test/tests/p5.AudioVoice.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
describe('p5.AudioVoice', function () {
22
it('can be created and disposed', function () {
3-
var av = new p5.AudioVoice();
3+
const av = new p5.AudioVoice();
44
av.dispose();
55
});
66
});

test/tests/p5.Compressor.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
var expect = chai.expect;
1+
const expect = chai.expect;
22

33
describe('p5.Compressor', function () {
44
it('can be created and disposed', function () {
5-
var compressor = new p5.Compressor();
5+
const compressor = new p5.Compressor();
66
compressor.dispose();
77
});
88

99
it('wet dry value can be changed', function () {
10-
var compressor = new p5.Compressor();
10+
const compressor = new p5.Compressor();
1111
expect(compressor.drywet(0.5)).to.equal(0.5);
1212
});
1313

1414
it('can set params', function () {
15-
var compressor = new p5.Compressor();
15+
const compressor = new p5.Compressor();
1616
compressor.set(0.5, 20, 15, -50, 0.75);
1717
expect(compressor.attack()).to.equal(0.5);
1818
expect(compressor.knee()).to.equal(20);

test/tests/p5.Delay.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
var expect = chai.expect;
1+
const expect = chai.expect;
22

33
describe('p5.Delay', function () {
44
it('can be created and disposed', function () {
5-
var delay = new p5.Delay();
5+
const delay = new p5.Delay();
66
delay.dispose();
77
});
88

99
it('has initial feedback value of 0.5', function () {
10-
var delay = new p5.Delay();
10+
const delay = new p5.Delay();
1111
expect(delay.feedback()).to.equal(0.5);
1212
});
1313

1414
it('can set feedback', function () {
15-
var delay = new p5.Delay();
15+
const delay = new p5.Delay();
1616
delay.feedback(0.7);
1717
expect(delay.feedback()).to.be.closeTo(0.7, 0.001);
1818
});
1919

2020
it('drywet value can be changed', function () {
21-
var effect = new p5.Effect();
21+
const effect = new p5.Effect();
2222
expect(effect.drywet(0.5)).to.equal(0.5);
2323
});
2424
});

test/tests/p5.Distortion.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
var expect = chai.expect;
1+
const expect = chai.expect;
22

33
describe('p5.Distortion', function () {
44
this.timeout(1000);
55

6-
var dist = new p5.Distortion();
6+
const dist = new p5.Distortion();
77

88
it('can be created and disposed', function () {
9-
var d = new p5.Distortion();
9+
const d = new p5.Distortion();
1010
d.dispose();
1111
});
1212

1313
it('can set the amount and oversample', function () {
14-
var initialAmt = dist.getAmount();
15-
var initialOS = dist.getOversample();
14+
const initialAmt = dist.getAmount();
15+
const initialOS = dist.getOversample();
1616
dist.set(1000, '4x');
1717
expect(dist.getAmount()).not.equal(initialAmt);
1818
expect(dist.getOversample()).not.equal(initialOS);

test/tests/p5.EQ.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
var expect = chai.expect;
1+
const expect = chai.expect;
22

33
describe('p5.EQ', function () {
44
it('can be created and disposed', function () {
5-
var origSoundArrayLength = p5.soundOut.soundArray.length;
6-
var eq = new p5.EQ();
5+
const origSoundArrayLength = p5.soundOut.soundArray.length;
6+
const eq = new p5.EQ();
77
expect(p5.soundOut.soundArray.length).to.not.equal(origSoundArrayLength);
88
eq.dispose();
99
expect(p5.soundOut.soundArray.length).to.equal(origSoundArrayLength);
@@ -13,7 +13,7 @@ describe('p5.EQ', function () {
1313
});
1414

1515
it('can be only be created with size 3 or 8', function () {
16-
var eq = new p5.EQ();
16+
let eq = new p5.EQ();
1717
expect(eq.bands.length).to.equal(3);
1818
eq.dispose();
1919
eq = new p5.EQ(3);
@@ -28,7 +28,7 @@ describe('p5.EQ', function () {
2828
});
2929

3030
it('a band can be toggled on and off', function () {
31-
var eq = new p5.EQ(8);
31+
const eq = new p5.EQ(8);
3232
expect(eq.bands[2].biquad.type).to.equal('peaking');
3333
eq.bands[2].toggle();
3434
expect(eq.bands[2].biquad.type).to.equal('allpass');
@@ -37,29 +37,29 @@ describe('p5.EQ', function () {
3737
});
3838

3939
it('a bands gain value can be changed', function () {
40-
var eq = new p5.EQ(8);
40+
const eq = new p5.EQ(8);
4141
expect(eq.bands[2].gain()).to.equal(0);
4242
eq.bands[2].gain(30);
4343
expect(eq.bands[2].gain()).to.equal(30);
4444
});
4545

4646
it('a bands freq value can be changed', function () {
47-
var eq = new p5.EQ(8);
47+
const eq = new p5.EQ(8);
4848
expect(eq.bands[0].freq()).to.equal(100);
4949
eq.bands[0].freq(200);
5050
expect(eq.bands[0].gain()).to.equal(0);
5151
expect(eq.bands[0].freq()).to.equal(200);
5252
});
5353

5454
it('a bands type can be changed', function () {
55-
var eq = new p5.EQ();
55+
const eq = new p5.EQ();
5656
expect(eq.bands[2]._untoggledType).to.equal('peaking');
5757
eq.bands[2].setType('highshelf');
5858
expect(eq.bands[2]._untoggledType).to.equal('highshelf');
5959
});
6060

6161
it('drywet value can be changed', function () {
62-
var eq = new p5.EQ();
62+
const eq = new p5.EQ();
6363
expect(eq.drywet(0.5)).to.equal(0.5);
6464
});
6565
});

test/tests/p5.Effect.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
var expect = chai.expect;
1+
const expect = chai.expect;
22

33
describe('p5.Effect', function () {
44
it('can be created and disposed', function () {
5-
var effect = new p5.Effect();
5+
const effect = new p5.Effect();
66
effect.dispose();
77
expect(effect.wet).to.equal(undefined);
88
expect(effect._drywet).to.equal(undefined);
@@ -11,21 +11,21 @@ describe('p5.Effect', function () {
1111
});
1212

1313
it('drywet value can be changed', function () {
14-
var effect = new p5.Effect();
14+
const effect = new p5.Effect();
1515
expect(effect.drywet(0.5)).to.equal(0.5);
1616
});
1717

1818
it('drywet value can be used as getter and setter', function () {
19-
var effect = new p5.Effect();
19+
const effect = new p5.Effect();
2020
expect(effect.drywet(0.5)).to.equal(0.5);
2121
expect(effect.drywet()).to.equal(0.5);
2222
});
2323

2424
it('effects can be chained together', function () {
25-
var filter = new p5.Filter();
26-
var delay = new p5.Delay();
27-
var reverb = new p5.Reverb();
28-
var distortion = new p5.Distortion();
25+
const filter = new p5.Filter();
26+
const delay = new p5.Delay();
27+
const reverb = new p5.Reverb();
28+
const distortion = new p5.Distortion();
2929
filter.chain(delay, reverb, distortion);
3030
});
3131

test/tests/p5.FFT.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
var expect = chai.expect;
1+
const expect = chai.expect;
22

33
describe('p5.FFT', function () {
4-
var fft;
4+
let fft;
55

66
beforeEach(function () {
77
fft = new p5.FFT();

test/tests/p5.Filter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
var expect = chai.expect;
1+
const expect = chai.expect;
22

33
describe('p5.Filter', function () {
44
it('can be created and disposed', function () {
5-
var filter = new p5.Filter();
5+
const filter = new p5.Filter();
66
filter.dispose();
77
});
88

99
it('has initial drywet value of 0.5', function () {
10-
var filter = new p5.Filter();
10+
const filter = new p5.Filter();
1111
expect(filter.drywet(0.5)).to.equal(0.5);
1212
});
1313

1414
it('audio can be processed', function () {
15-
var filter = new p5.Filter();
16-
var sound = new p5.SoundFile('./testAudio/drum.mp3');
15+
const filter = new p5.Filter();
16+
const sound = new p5.SoundFile('./testAudio/drum.mp3');
1717
filter.process(sound, 500, 5);
1818
});
1919
});

0 commit comments

Comments
 (0)