You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ra...@apache.org on 2019/10/20 18:34:17 UTC

[cordova-lib] branch master updated: Fix cordova/emulate.spec (#804)

This is an automated email from the ASF dual-hosted git repository.

raphinesse pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git


The following commit(s) were added to refs/heads/master by this push:
     new 270c3ca  Fix cordova/emulate.spec (#804)
270c3ca is described below

commit 270c3cad4cbc9a7dbd667d85f2c924d18c77ed9c
Author: Raphael von der GrĂ¼n <ra...@gmail.com>
AuthorDate: Sun Oct 20 20:34:08 2019 +0200

    Fix cordova/emulate.spec (#804)
    
    * Fix copy/paste errors in cordova/emulate.spec
    
    * Remove filtering-out of non-existant platform
---
 spec/cordova/emulate.spec.js | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/spec/cordova/emulate.spec.js b/spec/cordova/emulate.spec.js
index c5e353b..af4e333 100644
--- a/spec/cordova/emulate.spec.js
+++ b/spec/cordova/emulate.spec.js
@@ -21,7 +21,7 @@ var platforms = require('../../src/platforms/platforms');
 var HooksRunner = require('../../src/hooks/HooksRunner');
 var util = require('../../src/cordova/util');
 
-var supported_platforms = Object.keys(platforms).filter(function (p) { return p !== 'www'; });
+var supported_platforms = Object.keys(platforms);
 
 describe('emulate command', function () {
     var is_cordova;
@@ -46,7 +46,7 @@ describe('emulate command', function () {
     describe('failure', function () {
         it('Test 001 : should not run inside a Cordova-based project with no added platforms by calling util.listPlatforms', function () {
             list_platforms.and.returnValue([]);
-            return cordova.compile()
+            return cordova.emulate()
                 .then(function () {
                     fail('Expected promise to be rejected');
                 }, function (err) {
@@ -56,7 +56,7 @@ describe('emulate command', function () {
         });
         it('Test 002 : should not run outside of a Cordova-based project', function () {
             is_cordova.and.returnValue(false);
-            return cordova.compile()
+            return cordova.emulate()
                 .then(function () {
                     fail('Expected promise to be rejected');
                 }, function (err) {
@@ -99,11 +99,15 @@ describe('emulate command', function () {
                 platformApi.build = originalBuildSpy;
             });
             it('Test 006 : should leave parameters unchanged', function () {
-                return cordova.run({ platforms: ['blackberry10'], options: { password: '1q1q' } })
+                const baseOptions = { password: '1q1q', device: false, emulator: true };
+                const expectedRunOptions = Object.assign({ nobuild: true }, baseOptions);
+                const expectedBuildOptions = Object.assign({ couldBeModified: 'insideBuild' }, baseOptions);
+
+                return cordova.emulate({ platforms: ['blackberry10'], options: { password: '1q1q' } })
                     .then(function () {
-                        expect(prepare_spy).toHaveBeenCalledWith({ platforms: [ 'blackberry10' ], options: { password: '1q1q', 'couldBeModified': 'insideBuild' }, verbose: false });
-                        expect(platformApi.build).toHaveBeenCalledWith({ password: '1q1q', 'couldBeModified': 'insideBuild' });
-                        expect(platformApi.run).toHaveBeenCalledWith({ password: '1q1q', nobuild: true });
+                        expect(prepare_spy).toHaveBeenCalledWith({ platforms: [ 'blackberry10' ], options: expectedBuildOptions, verbose: false });
+                        expect(platformApi.build).toHaveBeenCalledWith(expectedBuildOptions);
+                        expect(platformApi.run).toHaveBeenCalledWith(expectedRunOptions);
                     });
             });
         });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org