Skip to content

Commit

Permalink
Tessel.Port: ensure that bus protocol interface wrappers are construc…
Browse files Browse the repository at this point in the history
…tors

Signed-off-by: Rick Waldron <[email protected]>
  • Loading branch information
rwaldron committed May 4, 2017
1 parent d3d37e5 commit 6311c12
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions node/test/unit/tessel.js
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,32 @@ exports['Tessel.Port'] = {

test.done();
},

busProtocolClassWrappersAreConstructors: function(test) {
test.expect(6);

sandbox.stub(Tessel, 'I2C');
sandbox.stub(Tessel, 'SPI');
sandbox.stub(Tessel, 'UART');

var port = new Tessel.Port('B', '/foo/bar/baz', this.tessel);

test.doesNotThrow(() => {
new port.I2C(1);
});
test.doesNotThrow(() => {
new port.SPI({});
});
test.doesNotThrow(() => {
new port.UART({});
});

test.equal(Tessel.I2C.callCount, 1);
test.equal(Tessel.SPI.callCount, 1);
test.equal(Tessel.UART.callCount, 1);

test.done();
},
};

exports['Tessel.Port.prototype'] = {
Expand Down

0 comments on commit 6311c12

Please sign in to comment.