[GitHub] cordova-lib pull request #577: CB-12361 : added tests for platform/list.js
Github user stevengill commented on a diff in the pull request: https://github.com/apache/cordova-lib/pull/577#discussion_r132738598 --- Diff: spec/cordova/platform/list.spec.js --- @@ -0,0 +1,75 @@ +/** +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at +http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +var events = require('cordova-common').events; +var Q = require('q'); +var rewire = require('rewire'); +var platform_list = rewire('../../../src/cordova/platform/list'); --- End diff -- i don't think you use rewire anywhere in this file --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-lib pull request #577: CB-12361 : added tests for platform/list.js
Github user stevengill commented on a diff in the pull request: https://github.com/apache/cordova-lib/pull/577#discussion_r132742737 --- Diff: spec/cordova/platform/list.spec.js --- @@ -0,0 +1,75 @@ +/** +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at +http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +var events = require('cordova-common').events; +var Q = require('q'); +var rewire = require('rewire'); +var platform_list = rewire('../../../src/cordova/platform/list'); +var platform_metadata = require('../../../src/cordova/platform_metadata'); +var cordova_util = require('../../../src/cordova/util'); +var fail; + +describe('cordova/platform/list', function () { +var hooks_mock; +var projectRoot = '/some/path'; + +beforeEach(function () { +hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']); +hooks_mock.fire.and.returnValue(Q()); +spyOn(cordova_util, 'getInstalledPlatformsWithVersions').and.callThrough(); +spyOn(events, 'emit'); +spyOn(platform_metadata, 'save'); +spyOn(cordova_util, 'requireNoCache').and.returnValue({}); +}); + +it('should fire the before_platform_ls hook', function () { +platform_list(hooks_mock, projectRoot, {save: true}); +expect(hooks_mock.fire).toHaveBeenCalledWith('before_platform_ls', Object({ save: true })); +}); + +it('should file the after_platform_ls hook', function (done) { --- End diff -- type. Should be fire --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-lib pull request #577: CB-12361 : added tests for platform/list.js
Github user stevengill commented on a diff in the pull request: https://github.com/apache/cordova-lib/pull/577#discussion_r129730654 --- Diff: spec/cordova/platform/list.spec.js --- @@ -0,0 +1,66 @@ +/** +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at +http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +var events = require('cordova-common').events; +var Q = require('q'); +var events = require('cordova-common').events; +var rewire = require('rewire'); +var platform_list = rewire('../../../src/cordova/platform/list'); +var platform_metadata = require('../../../src/cordova/platform_metadata'); +var cordova_util = require('../../../src/cordova/util'); +var fail; + +describe('cordova/platform/list', function () { +var hooks_mock; +var projectRoot = '/some/path'; + +beforeEach(function () { +hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']); +hooks_mock.fire.and.returnValue(Q()); +spyOn(cordova_util, 'getInstalledPlatformsWithVersions').and.callThrough(); +spyOn(events, 'emit'); +spyOn(platform_metadata, 'save'); +spyOn(cordova_util, 'requireNoCache').and.returnValue({}); +}); + +it('should fire the before_platform_ls hook', function () { +platform_list(hooks_mock, projectRoot, {save : true}); +expect(hooks_mock.fire).toHaveBeenCalledWith('before_platform_ls', Object({ save: true })); +}); + +it('should file the after_platform_ls hook',function (done) { +platform_list(hooks_mock, projectRoot, {save : true}) +.then(function(result) { + expect(hooks_mock.fire).toHaveBeenCalledWith('after_platform_ls', Object({ save: true })); +}).fail(function (err) { +console.log(err.message); +fail('unexpected failure handler invoked!'); +console.error(err); +}).done(done); +}); + +it('should print results of available platforms',function (done) { +platform_list(hooks_mock, projectRoot, {save : true}) +.then(function(result) { +expect(events.emit).toHaveBeenCalledWith('results', jasmine.stringMatching(/Installed platforms:/)); +}).fail(function (err) { +console.log(err.message); --- End diff -- I don't think your fail function should `console.log(err.message)` and `console.log(err)`. Just `console.log(err)` is sufficient. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-lib pull request #577: CB-12361 : added tests for platform/list.js
Github user stevengill commented on a diff in the pull request: https://github.com/apache/cordova-lib/pull/577#discussion_r129730691 --- Diff: spec/cordova/platform/list.spec.js --- @@ -0,0 +1,66 @@ +/** +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at +http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +var events = require('cordova-common').events; +var Q = require('q'); +var events = require('cordova-common').events; +var rewire = require('rewire'); +var platform_list = rewire('../../../src/cordova/platform/list'); +var platform_metadata = require('../../../src/cordova/platform_metadata'); +var cordova_util = require('../../../src/cordova/util'); +var fail; + +describe('cordova/platform/list', function () { +var hooks_mock; +var projectRoot = '/some/path'; + +beforeEach(function () { +hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']); +hooks_mock.fire.and.returnValue(Q()); +spyOn(cordova_util, 'getInstalledPlatformsWithVersions').and.callThrough(); +spyOn(events, 'emit'); +spyOn(platform_metadata, 'save'); +spyOn(cordova_util, 'requireNoCache').and.returnValue({}); +}); + +it('should fire the before_platform_ls hook', function () { +platform_list(hooks_mock, projectRoot, {save : true}); +expect(hooks_mock.fire).toHaveBeenCalledWith('before_platform_ls', Object({ save: true })); +}); + +it('should file the after_platform_ls hook',function (done) { +platform_list(hooks_mock, projectRoot, {save : true}) +.then(function(result) { + expect(hooks_mock.fire).toHaveBeenCalledWith('after_platform_ls', Object({ save: true })); +}).fail(function (err) { +console.log(err.message); +fail('unexpected failure handler invoked!'); +console.error(err); +}).done(done); +}); + +it('should print results of available platforms',function (done) { +platform_list(hooks_mock, projectRoot, {save : true}) +.then(function(result) { +expect(events.emit).toHaveBeenCalledWith('results', jasmine.stringMatching(/Installed platforms:/)); +}).fail(function (err) { +console.log(err.message); --- End diff -- This is the same case as the previous test too --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-lib pull request #577: CB-12361 : added tests for platform/list.js
GitHub user audreyso opened a pull request: https://github.com/apache/cordova-lib/pull/577 CB-12361 : added tests for platform/list.js ### Platforms affected ### What does this PR do? Added tests for platform/list.js ### What testing has been done on this change? ### Checklist - [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database - [X] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB- is the JIRA ID & "android" is the platform affected. - [X] Added automated test coverage as appropriate for this change. You can merge this pull request into a Git repository by running: $ git pull https://github.com/audreyso/cordova-lib CB-12361-8 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-lib/pull/577.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #577 commit 558554aea0654a4132feb057a73e3faa5a5bac1a Author: Audrey SoDate: 2017-07-17T23:06:37Z CB-12361 : added tests for list platform --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org