cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robpaveza <...@git.apache.org>
Subject [GitHub] cordova-windows pull request: CB-9283: Add support for Windows 10 ...
Date Wed, 08 Jul 2015 15:46:39 GMT
Github user robpaveza commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/96#discussion_r34163428
  
    --- Diff: spec/unit/deployment.spec.js ---
    @@ -0,0 +1,282 @@
    +/**
    +    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'),
    +    deployment = rewire('../../template/cordova/lib/deployment'),
    +    run        = deployment.__get__('run'),
    +    Q          = require('q'),
    +
    +    AppDeployCmdTool = deployment.__get__('AppDeployCmdTool'),
    +    WinAppDeployCmdTool = deployment.__get__('WinAppDeployCmdTool');
    +
    +var TEST_APP_PACKAGE_NAME = '"c:\\testapppackage.appx"',
    +    TEST_APP_PACKAGE_ID   = '12121212-3434-3434-3434-567856785678';
    +
    +describe('The correct version of the app deployment tool is obtained.', function() {
    +
    +    it('Provides an AppDeployCmdTool when 8.1 is requested.', function() {
    +
    +        var tool = deployment.getDeploymentTool('8.1');
    +        expect(tool instanceof AppDeployCmdTool).toBe(true);
    +
    +    });
    +
    +    it('Provides a WinAppDeployCmdTool when 10.0 is requested.', function() {
    +
    +        var tool = deployment.getDeploymentTool('10.0');
    +        expect(tool instanceof WinAppDeployCmdTool).toBe(true);
    +
    +    });
    +
    +});
    +
    +describe('Windows 10 deployment interacts with the file system as expected.', function()
{
    +
    +    function runMock(cmd, args, cwd) {
    +        expect(cmd).toBe('c:\\Program Files (x86)\\Windows Kits\\10\\bin\\x86\\WinAppDeployCmd.exe');
    +        switch (args[0]) {
    +            case 'devices':
    +                var output = 'Windows App Deployment Tool\r\nVersion 10.0.0.0\r\nCopyright
(c) Microsoft Corporation. All rights reserved.\r\n\r\nDiscovering devices...\r\nIP Address
     GUID                                    Model/Name\r\n127.0.0.1   00000015-b21e-0da9-0000-000000000000
   Lumia 1520 (RM-940)\r\n10.120.70.172   00000000-0000-0000-0000-00155d619532    00155D619532\r\n10.120.68.150
  00000000-0000-0000-0000-00155d011765    00155D011765\r\nDone.';
    +                return Q(output);
    +
    +            case 'update':
    +            case 'install':
    +                expect(args[2]).toBe(TEST_APP_PACKAGE_NAME);
    +                expect(args[4]).toBe('127.0.0.1');
    +                return Q('');
    +
    +            case 'uninstall':
    +                expect(args[2]).toBe(TEST_APP_PACKAGE_ID);
    +                expect(args[4]).toBe('10.120.68.150');
    +                return Q('');
    +
    +        }
    +    }
    +
    +    var mockedProgramFiles = process.env['ProgramFiles(x86)'];
    +    beforeEach(function() {
    +        deployment.__set__('run', runMock);    
    +        process.env['ProgramFiles(x86)'] = 'c:\\Program Files (x86)';
    +    });
    +    afterEach(function() {
    +        deployment.__set__('run', run);
    +        if (mockedProgramFiles) {
    +            process.env['ProgramFiles(x86)'] = mockedProgramFiles;
    +        } else {
    +            delete process.env['ProgramFiles(x86)'];
    +        }
    +    });
    +
    +    it('enumerateDevices returns a valid set of objects', function() {
    +        var deploymentTool = deployment.getDeploymentTool('10.0');
    +        var done = false;
    +        deploymentTool.enumerateDevices().then(function(deviceList) {
    +
    +            expect(deviceList.length).toBe(3);
    +            expect(deviceList[0].name).toBe('Lumia 1520 (RM-940)');
    +            expect(deviceList[0].index).toBe(0);
    +            expect(deviceList[0].type).toBe('device');
    +            
    +            done = true;
    +
    +        });
    +
    +        waitsFor(function() { return done; });
    +    });
    +
    +    it('installAppPackage passes the correct set of parameters', function() {
    +        var deploymentTool = deployment.getDeploymentTool('10.0');
    +        var done = false;
    +        deploymentTool.enumerateDevices().then(function(deviceList) {
    +            deploymentTool.installAppPackage(TEST_APP_PACKAGE_NAME, deviceList[0], false,
false).then(function() {
    +
    +                // expect() calls are in the runMock function
    +                done = true;
    +
    +            });
    +        });
    +
    +        waitsFor(function() { return done; });
    --- End diff --
    
    Yes it is.  Jasmine 2 has some new features with respect to async, but yeah, this is pretty
gross.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message