Skip to content

Commit

Permalink
Grunt pass
Browse files Browse the repository at this point in the history
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
  • Loading branch information
rwaldron committed Aug 18, 2016
1 parent bb66613 commit ba3b48f
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 58 deletions.
4 changes: 2 additions & 2 deletions lib/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ controller.connectToNetwork = function(opts) {
if (security && securityOptions.indexOf(security) < 0) {
return reject(`"${security}" is not a valid security option. Please choose on of the following: ${securityOptions.join(', ')}`);
}

if (security === 'wep') {
// WEP passphrases can be 10, 26, or 58 hexadecimal digits long.
// Match for hexadecimal characters:
Expand All @@ -702,7 +702,7 @@ controller.connectToNetwork = function(opts) {
return reject('Invalid passphrase: WEP keys must be 10, 26, or 58 digits long for 64-, 128-, and 256-bit WEP.');
}
}

if (security === 'psk' || security === 'psk2') {
// WPA/WPA2-PSK passphrases can be 8-63 ASCII characters, or 64 hexadecimal digits.
// Match ASCII codes for all 127 printable ASCII characters:
Expand Down
112 changes: 56 additions & 56 deletions test/unit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1071,98 +1071,98 @@ exports['controller.closeTesselConnections'] = {
test.expect(1);

controller.createAccessPoint({
ssid: 'test',
password: 'nothexdigits',
security: 'wep'
})
.catch(error => {
test.ok(error);
test.done();
});
ssid: 'test',
password: 'nothexdigits',
security: 'wep'
})
.catch(error => {
test.ok(error);
test.done();
});
},

invalidAccessPointWEPPasswordLength: function(test) {
test.expect(1);

controller.createAccessPoint({
ssid: 'test',
password: '0123456789ABCDEF',
security: 'wep'
})
.catch(error => {
test.ok(error);
test.done();
});
ssid: 'test',
password: '0123456789ABCDEF',
security: 'wep'
})
.catch(error => {
test.ok(error);
test.done();
});
},

invalidAccessPointPSKPasswordCharacters: function(test) {
test.expect(1);

controller.createAccessPoint({
ssid: 'test',
password: 'Password™',
security: 'psk'
})
.catch(error => {
test.ok(error);
test.done();
});
ssid: 'test',
password: 'Password™',
security: 'psk'
})
.catch(error => {
test.ok(error);
test.done();
});
},

invalidAccessPointPSKASCIIPasswordTooShort: function(test) {
test.expect(1);

controller.createAccessPoint({
ssid: 'test',
password: 'short',
security: 'psk'
})
.catch(error => {
test.ok(error);
test.done();
});
ssid: 'test',
password: 'short',
security: 'psk'
})
.catch(error => {
test.ok(error);
test.done();
});
},

invalidAccessPointPSKASCIIPasswordTooLong: function(test) {
test.expect(1);

controller.createAccessPoint({
ssid: 'test',
password: 'this is a very long passphrase. in fact, it is over 63 characters, which makes it invalid.',
security: 'psk'
})
.catch(error => {
test.ok(error);
test.done();
});
ssid: 'test',
password: 'this is a very long passphrase. in fact, it is over 63 characters, which makes it invalid.',
security: 'psk'
})
.catch(error => {
test.ok(error);
test.done();
});
},

invalidAccessPointPSKHexPasswordTooShort: function(test) {
test.expect(1);

controller.createAccessPoint({
ssid: 'test',
password: 'DEAD',
security: 'psk'
})
.catch(error => {
test.ok(error);
test.done();
});
ssid: 'test',
password: 'DEAD',
security: 'psk'
})
.catch(error => {
test.ok(error);
test.done();
});
},

invalidAccessPointPSKHexPasswordTooLong: function(test) {
test.expect(1);

controller.createAccessPoint({
ssid: 'test',
password: 'DEADDEADDEADDEADDEADDEADDEADDEADDEADDEADDEADDEADDEADDEADDEADDEADDEAD',
security: 'psk'
})
.catch(error => {
test.ok(error);
test.done();
});
ssid: 'test',
password: 'DEADDEADDEADDEADDEADDEADDEADDEADDEADDEADDEADDEADDEADDEADDEADDEADDEAD',
security: 'psk'
})
.catch(error => {
test.ok(error);
test.done();
});
},
};

Expand Down

0 comments on commit ba3b48f

Please sign in to comment.