You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/08/01 03:07:42 UTC

[GitHub] erisu commented on a change in pull request #377: Increase Code Coverage & use nyc

erisu commented on a change in pull request #377: Increase Code Coverage & use nyc
URL: https://github.com/apache/cordova-ios/pull/377#discussion_r206743811
 
 

 ##########
 File path: tests/spec/unit/versions.spec.js
 ##########
 @@ -0,0 +1,91 @@
+/**
+ 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 rewire = require('rewire');
+var versions = rewire('../../../bin/templates/scripts/cordova/lib/versions');
+
+// These tests can not run on windows.
+if (process.platform === 'darwin') {
+    describe('versions', function () {
+        describe('get_apple_ios_version method', () => {
+            it('should have found ios version.', (done) => {
+                let _console = versions.__get__('console');
+                let logSpy = jasmine.createSpy('logSpy');
+                versions.__set__('console', {log: logSpy});
+
+                versions.get_apple_ios_version().then(() => {
+                    expect(logSpy).not.toHaveBeenCalledWith(undefined);
+                    versions.__set__('console', _console);
+                    done();
+                });
+            });
+        });
+
+        describe('get_apple_osx_version method', () => {
+            it('should have found osx version.', (done) => {
+                let _console = versions.__get__('console');
+                let logSpy = jasmine.createSpy('logSpy');
+                versions.__set__('console', {log: logSpy});
+
+                versions.get_apple_osx_version().then(() => {
+                    expect(logSpy).not.toHaveBeenCalledWith(undefined);
+                    versions.__set__('console', _console);
+                    done();
+                });
+            });
+        });
+
+        describe('get_tool_version method', () => {
+            it('should not have found tool by name.', (done) => {
+                versions.get_tool_version('unknown').catch((error) => {
+                    expect(error).toContain('is not valid tool name');
+                    done();
+                });
+            });
+
+            it('should find xcodebuild version.', (done) => {
+                versions.get_tool_version('xcodebuild').then((version) => {
+                    expect(version).not.toBe(undefined);
+                    done();
+                });
+            });
+
+            it('should find ios-sim version.', (done) => {
 
 Review comment:
   Adding `ios-deploy` to `package.json` as a devDep will cause AppVeyor to fail. This package can only be installed and used on the Darwin platforms. 
   
   I question if testing iOS/macOS platform on AppVeyor is actually needed. Xcode is a build requirement and Windows cant use Xcode, and AppVeyor is running on Windows, what is achieved with this test.
   
   ```
   npm ERR! code EBADPLATFORM
   
   npm ERR! notsup Unsupported platform for ios-deploy@1.9.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"})
   npm ERR! notsup Valid OS:    darwin
   npm ERR! notsup Valid Arch:  any
   npm ERR! notsup Actual OS:   win32
   npm ERR! notsup Actual Arch: ia32
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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