|
| 1 | +import ma = require('vsts-task-lib/mock-answer'); |
| 2 | +import tmrm = require('vsts-task-lib/mock-run'); |
| 3 | +import path = require('path'); |
| 4 | +import util = require('../DotnetMockHelper'); |
| 5 | + |
| 6 | +let taskPath = path.join(__dirname, '../..', 'dotnetcore.js'); |
| 7 | +let tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath); |
| 8 | +let nmh: util.DotnetMockHelper = new util.DotnetMockHelper(tmr); |
| 9 | + |
| 10 | +nmh.setNugetVersionInputDefault(); |
| 11 | +nmh.setOnPremServerUris(); |
| 12 | +tmr.setInput('command', 'push'); |
| 13 | +tmr.setInput('searchPatternPush', 'foo.nupkg'); |
| 14 | +tmr.setInput('nuGetFeedType', 'internal'); |
| 15 | +tmr.setInput('feedPublish', 'FeedFooId'); |
| 16 | + |
| 17 | +let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{ |
| 18 | + "osType": {}, |
| 19 | + "checkPath": { |
| 20 | + "c:\\agent\\home\\directory\\foo.nupkg": true, |
| 21 | + "c:\\path\\dotnet.exe": true |
| 22 | + }, |
| 23 | + "which": { |
| 24 | + "dotnet": "c:\\path\\dotnet.exe" |
| 25 | + }, |
| 26 | + "exec": { |
| 27 | + "c:\\path\\dotnet.exe nuget push c:\\agent\\home\\directory\\foo.nupkg --source https://vsts/packagesource --api-key VSTS": { |
| 28 | + "code": 0, |
| 29 | + "stdout": "dotnet output", |
| 30 | + "stderr": "" |
| 31 | + } |
| 32 | + }, |
| 33 | + "exist": {}, |
| 34 | + "stats": { |
| 35 | + "c:\\agent\\home\\directory\\foo.nupkg": { |
| 36 | + "isFile": true |
| 37 | + } |
| 38 | + }, |
| 39 | + "rmRF": { |
| 40 | + "c:\\agent\\home\\directory\\NuGet_1": { |
| 41 | + "success": true |
| 42 | + }, |
| 43 | + "c:\\agent\\home\\directory/NuGet_1": { |
| 44 | + "success": true |
| 45 | + } |
| 46 | + }, |
| 47 | + "findMatch": { |
| 48 | + "foo.nupkg" : ["c:\\agent\\home\\directory\\foo.nupkg"] |
| 49 | + } |
| 50 | +}; |
| 51 | +nmh.setAnswers(a); |
| 52 | + |
| 53 | +nmh.registerNugetUtilityMock(["c:\\agent\\home\\directory\\foo.nupkg"]); |
| 54 | +nmh.registerDefaultNugetVersionMock(); |
| 55 | +nmh.registerToolRunnerMock(); |
| 56 | +nmh.registerNugetConfigMock(); |
| 57 | +nmh.RegisterLocationServiceMocks(); |
| 58 | + |
| 59 | +tmr.run(); |
0 commit comments