Skip to content

Commit f5f85b8

Browse files
committed
Include tests in linting and clean up linting errors
1 parent 64819c0 commit f5f85b8

18 files changed

+106
-98
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Gruntfile.js
2+
test/test.js

src/.eslintrc renamed to .eslintrc

File renamed without changes.

Gruntfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ module.exports = function(grunt) {
66
// Configure style consistency
77
eslint: {
88
source: {
9-
options: {configFile: './src/.eslintrc'},
10-
src: ['src/**/*.js']
9+
options: {configFile: './.eslintrc'},
10+
src: ['src/**/*.js', 'test/tests/**/*.js']
1111
}
1212
},
1313
watch: {

test/tests/p5.Amplitude.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
define(['chai'],
2-
function(chai) {
1+
'use strict';
32

3+
define(['chai'], function(chai) {
44
var expect = chai.expect;
55

66
describe('p5.Amplitude', function() {
77
this.timeout(1000);
88

99
var sf, amp;
1010

11-
it('can be created', function(){
11+
it('can be created', function() {
1212
amp = new p5.Amplitude();
1313
});
1414

15-
after(function(done){
15+
after(function(done) {
1616
expect( amp.getLevel() ).to.not.equal(1.0);
1717
osc.dispose();
1818
sf.dispose();
@@ -37,7 +37,7 @@ define(['chai'],
3737
});
3838

3939
it('gets normalized osc level', function(done) {
40-
setTimeout(function(cleanup) {
40+
setTimeout(function() {
4141
oAmp.toggleNormalize(true);
4242
// console.log( 'normalized: ' + oAmp.getLevel() );
4343
expect( oAmp.getLevel() ).to.be.closeTo(1.0, 0.4);
@@ -46,9 +46,9 @@ define(['chai'],
4646
});
4747

4848

49-
it('loop a SoundFile with params, disconnected from master, setInput()', function(done){
49+
it('loop a SoundFile with params, disconnected from master, setInput()', function(done) {
5050
p5.prototype.soundFormats('ogg', 'mp3');
51-
sf = p5.prototype.loadSound('./testAudio/drum', function(){
51+
sf = p5.prototype.loadSound('./testAudio/drum', function() {
5252
sf.disconnect();
5353
sf.loop(1,1,0.0, 0.05);
5454
sf.connect(amp);
@@ -67,4 +67,4 @@ define(['chai'],
6767
});
6868

6969
});
70-
});
70+
});

test/tests/p5.AudioIn.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
define(['chai'],
2-
function(chai) {
1+
'use strict';
2+
3+
define(['chai'], function(chai) {
34

45
var expect = chai.expect;
56

67
describe('p5.AudioIn', function() {
7-
it('can be created and disposed', function(){
8+
it('can be created and disposed', function() {
89
var mic = new p5.AudioIn();
910
mic.dispose();
1011
});
@@ -29,7 +30,7 @@ define(['chai'],
2930
var mic = new p5.AudioIn();
3031
expect(mic.currentSource).to.be.null;
3132

32-
return mic.getSources().then(function(sources) {
33+
return mic.getSources().then(function() {
3334
mic.setSource(0);
3435
expect(mic.currentSource).to.equal(0);
3536
done();

test/tests/p5.AudioVoice.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
define(['chai'],
2-
function(chai) {
1+
'use strict';
32

3+
define(['chai'], function(chai) {
44
var expect = chai.expect;
55

66
describe('p5.AudioVoice', function() {
@@ -12,7 +12,7 @@ define(['chai'],
1212

1313
it('can convert strings to frequency values', function() {
1414
var av = new p5.AudioVoice();
15-
var freq = av._setNote("A4");
15+
var freq = av._setNote('A4');
1616
expect(freq).to.equal(440);
1717
av.dispose();
1818
});

test/tests/p5.Compressor.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
define(['chai'],
2-
function(chai) {
1+
'use strict';
32

3+
define(['chai'], function(chai) {
44
var expect = chai.expect;
55

66
describe('p5.Compressor', function() {
@@ -10,12 +10,12 @@ define(['chai'],
1010
compressor.dispose();
1111
});
1212

13-
it('wet dry value can be changed', function(){
13+
it('wet dry value can be changed', function() {
1414
var compressor = new p5.Compressor();
1515
expect(compressor.drywet(0.5)).to.equal(0.5);
1616
});
1717

18-
it('can set params', function(){
18+
it('can set params', function() {
1919
var compressor = new p5.Compressor();
2020
compressor.set(0.5, 20, 15, -50, 0.75);
2121
expect(compressor.attack()).to.equal(0.5);

test/tests/p5.Delay.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
define(['chai'],
2-
function(chai) {
1+
'use strict';
2+
3+
define(['chai'], function(chai) {
34

45
var expect = chai.expect;
56

@@ -10,22 +11,21 @@ define(['chai'],
1011
delay.dispose();
1112
});
1213

13-
it('has initial feedback value of 0.5', function(){
14+
it('has initial feedback value of 0.5', function() {
1415
var delay = new p5.Delay();
1516
expect(delay.feedback()).to.equal(0.5);
1617
});
1718

18-
it('can set feedback', function(){
19+
it('can set feedback', function() {
1920
var delay = new p5.Delay();
2021
delay.feedback(0.7);
2122
expect(delay.feedback()).to.be.closeTo(0.7, 0.001);
2223
});
2324

24-
it('drywet value can be changed', function(){
25+
it('drywet value can be changed', function() {
2526
var effect = new p5.Effect();
26-
2727
expect(effect.drywet(0.5)).to.equal(0.5);
2828
});
2929

3030
});
31-
});
31+
});

test/tests/p5.Distortion.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
define(['chai'],
2-
function(chai) {
1+
'use strict';
32

4-
var expect = chai.expect;
3+
define(['chai'], function(chai) {
4+
var expect = chai.expect;
55

6-
describe('p5.Distortion', function() {
7-
this.timeout(1000);
6+
describe('p5.Distortion', function() {
7+
this.timeout(1000);
88

9-
var dist = new p5.Distortion();
9+
var dist = new p5.Distortion();
1010

11-
it('can be created and disposed', function() {
12-
var d = new p5.Distortion();
13-
d.dispose();
14-
});
11+
it('can be created and disposed', function() {
12+
var d = new p5.Distortion();
13+
d.dispose();
14+
});
1515

16-
it('can set the amount and oversample', function() {
17-
var initialAmt = dist.getAmount();
18-
var initialOS = dist.getOversample();
19-
dist.set(1000, '4x');
20-
expect(dist.getAmount()).not.equal(initialAmt);
21-
expect(dist.getOversample()).not.equal(initialOS);
22-
});
16+
it('can set the amount and oversample', function() {
17+
var initialAmt = dist.getAmount();
18+
var initialOS = dist.getOversample();
19+
dist.set(1000, '4x');
20+
expect(dist.getAmount()).not.equal(initialAmt);
21+
expect(dist.getOversample()).not.equal(initialOS);
2322
});
23+
});
2424
});

test/tests/p5.EQ.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
define(['chai'],
2-
function(chai) {
1+
'use strict';
2+
3+
define(['chai'], function(chai) {
34

45
var expect = chai.expect;
56

@@ -32,7 +33,7 @@ define(['chai'],
3233
});
3334

3435
it('a band can be toggled on and off', function() {
35-
var eq = new p5.EQ(8);
36+
var eq = new p5.EQ(8);
3637
expect(eq.bands[2].biquad.type).to.equal('peaking');
3738
eq.bands[2].toggle();
3839
expect(eq.bands[2].biquad.type).to.equal('allpass');
@@ -57,12 +58,12 @@ define(['chai'],
5758

5859
it('a bands type can be changed', function() {
5960
var eq = new p5.EQ();
60-
expect(eq.bands[2]._untoggledType=='peaking');
61+
expect(eq.bands[2]._untoggledType).to.equal('peaking');
6162
eq.bands[2].setType('highshelf');
62-
expect(eq.bands[2]._untoggledType=='highshelf');
63+
expect(eq.bands[2]._untoggledType).to.equal('highshelf');
6364
});
6465

65-
it('drywet value can be changed', function(){
66+
it('drywet value can be changed', function() {
6667
var eq = new p5.EQ();
6768
expect(eq.drywet(0.5)).to.equal(0.5);
6869
});

0 commit comments

Comments
 (0)