'use strict' ; import ma = require ( 'azure-pipelines-task-lib/mock-answer' ) ; import tmrm = require ( 'azure-pipelines-task-lib/mock-run' ) ; import path = require ( 'path' ) ; import os = require ( 'os' ) ; let taskPath = path . join ( __dirname , '..' , 'app-store-release.js' ) ; let tmr = new tmrm . TaskMockRunner ( taskPath ) ; tmr . setInput ( 'authType' , 'UserAndPass' ) ; tmr . setInput ( 'username' , 'creds-username' ) ; tmr . setInput ( 'password' , 'creds-password' ) ; tmr . setInput ( 'releaseTrack' , 'TestFlight' ) ; tmr . setInput ( 'appType' , 'iOS' ) ; tmr . setInput ( 'ipaPath' , 'mypackage.ipa' ) ; tmr . setInput ( 'installFastlane' , 'true' ) ; tmr . setInput ( 'fastlaneToolsVersion' , 'LatestVersion' ) ; tmr . setInput ( 'shouldSkipSubmission' , 'true' ) ; process . env [ 'MOCK_NORMALIZE_SLASHES' ] = 'true' ; process . env [ 'HOME' ] = '/usr/bin' ; let gemCache = '/usr/bin/.gem-cache' ; let myAnswers = `{
    "which": {
        "ruby": "/usr/bin/ruby",
        "gem": "/usr/bin/gem",
        "fastlane": "/usr/bin/fastlane"
    },
    "checkPath" : {
        "/usr/bin/ruby": true,
        "/usr/bin/gem": true,
        "/usr/bin/fastlane": true
    },
    "findMatch": {
        "mypackage.ipa": [
            "mypackage.ipa"
        ]
    },
    "exec": {
        "/usr/bin/gem install fastlane": {
            "code": 0,
            "stdout": "1 gem installed"
        },
        "/usr/bin/gem update fastlane -i ${ gemCache }": {
            "code": 0,
            "stdout": "1 gem installed"
        },
        "fastlane pilot upload -u creds-username -i mypackage.ipa --skip_submission true": {
            "code": 0,
            "stdout": "consider it uploaded!"
        }
    }
 }` ; let json = JSON . parse ( myAnswers ) ; tmr . setAnswers ( < ma . TaskLibAnswers > json ) ; os . platform = ( ) => { return 'darwin' ; } ; tmr . registerMock ( 'os' , os ) ; tmr . run ( ) ;