|
| 1 | +/** |
| 2 | + Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + or more contributor license agreements. See the NOTICE file |
| 4 | + distributed with this work for additional information |
| 5 | + regarding copyright ownership. The ASF licenses this file |
| 6 | + to you under the Apache License, Version 2.0 (the |
| 7 | + "License"); you may not use this file except in compliance |
| 8 | + with the License. You may obtain a copy of the License at |
| 9 | +
|
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +
|
| 12 | + Unless required by applicable law or agreed to in writing, |
| 13 | + software distributed under the License is distributed on an |
| 14 | + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + KIND, either express or implied. See the License for the |
| 16 | + specific language governing permissions and limitations |
| 17 | + under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +var rewire = require('rewire'); |
| 21 | +var versions = rewire('../../../bin/templates/scripts/cordova/lib/versions'); |
| 22 | + |
| 23 | +// These tests can not run on windows. |
| 24 | +if (process.platform === 'darwin') { |
| 25 | + describe('versions', function () { |
| 26 | + describe('get_apple_ios_version method', () => { |
| 27 | + it('should have found ios version.', (done) => { |
| 28 | + var _console = versions.__get__('console'); |
| 29 | + var logSpy = jasmine.createSpy('logSpy'); |
| 30 | + versions.__set__('console', {log: logSpy}); |
| 31 | + |
| 32 | + versions.get_apple_ios_version().then(() => { |
| 33 | + expect(logSpy).not.toHaveBeenCalledWith(undefined); |
| 34 | + versions.__set__('console', _console); |
| 35 | + done(); |
| 36 | + }); |
| 37 | + }); |
| 38 | + }); |
| 39 | + |
| 40 | + describe('get_apple_osx_version method', () => { |
| 41 | + it('should have found osx version.', (done) => { |
| 42 | + var _console = versions.__get__('console'); |
| 43 | + var logSpy = jasmine.createSpy('logSpy'); |
| 44 | + versions.__set__('console', {log: logSpy}); |
| 45 | + |
| 46 | + versions.get_apple_osx_version().then(() => { |
| 47 | + expect(logSpy).not.toHaveBeenCalledWith(undefined); |
| 48 | + versions.__set__('console', _console); |
| 49 | + done(); |
| 50 | + }); |
| 51 | + }); |
| 52 | + }); |
| 53 | + }); |
| 54 | +} |
0 commit comments