From a7ad46884ad43b15375121081233e8343cd0dc63 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Fri, 15 Jan 2016 18:31:58 -0500 Subject: [PATCH] Critical fix for incorrect push args --- lib/tessel/deploy.js | 2 +- test/unit/deploy.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/tessel/deploy.js b/lib/tessel/deploy.js index 2894aa98..55c6aea0 100644 --- a/lib/tessel/deploy.js +++ b/lib/tessel/deploy.js @@ -757,7 +757,7 @@ actions.runScript = function(t, filepath, opts) { }); }; -actions.pushScript = function(t, opts) { +actions.pushScript = function(t, script, opts) { // Write the node start file return actions.writeToFile(t, opts.entryPoint) .then(function start() { diff --git a/test/unit/deploy.js b/test/unit/deploy.js index 3e0d483c..b3bf5011 100644 --- a/test/unit/deploy.js +++ b/test/unit/deploy.js @@ -130,6 +130,9 @@ exports['Tessel.prototype.deployScript'] = { this.setExecutablePermissions = sandbox.spy(commands, 'setExecutablePermissions'); this.startPushedScript = sandbox.spy(commands, 'startPushedScript'); + this.pushScript = sandbox.spy(deploy, 'pushScript'); + this.writeToFile = sandbox.spy(deploy, 'writeToFile'); + this.injectBinaryModules = sandbox.stub(deploy, 'injectBinaryModules', function() { return Promise.resolve(); }); @@ -236,12 +239,19 @@ exports['Tessel.prototype.deployScript'] = { }, pushScript: function(test) { - test.expect(10); + test.expect(13); deployTestCode(this.tessel, test, { push: true, single: false }, function deployed(err) { test.ifError(err); + + var expectedPath = path.normalize('test/unit/tmp/app.js'); + + test.equal(this.pushScript.lastCall.args[1], expectedPath); + test.equal(this.pushScript.lastCall.args[2].entryPoint, expectedPath); + test.equal(this.writeToFile.lastCall.args[1], expectedPath); + test.equal(this.stopRunningScript.callCount, 1); // Delete and create both the flash and ram folders test.equal(this.deleteFolder.callCount, 2);