Last active
July 29, 2019 18:13
-
-
Save TsuyoshiUshio/d135dc1e64ba04b456d8d8d262b772a8 to your computer and use it in GitHub Desktop.
Mock by myself strategy sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as assert from 'assert'; | |
| import * as sinon from 'sinon'; | |
| import rewiremock from 'rewiremock'; | |
| import { should as Should, expect } from 'chai'; | |
| import { IGitApi, GitApi } from 'azure-devops-node-api/GitApi'; | |
| import * as GitInterfaces from "azure-devops-node-api/interfaces/GitInterfaces"; | |
| var should = Should(); | |
| let debugMessages: string[] = []; | |
| let variables: {[key: string]: string} = {}; | |
| let inputs: {[key: string]: string} = {}; | |
| rewiremock('azure-pipelines-task-lib') | |
| .with({ | |
| 'debug': sinon.stub().callsFake(m => debugMessages.push(m)), | |
| 'getInput': sinon.stub().callsFake(i => { return inputs[i] || null; }), | |
| 'getVariable': sinon.stub().callsFake(v => { return variables[v] || null; }), | |
| 'getEndpointAuthorizationParameter': () => "fooPAT", | |
| 'loc': sinon.stub().returnsArg(0) | |
| }); | |
| rewiremock.enable(); | |
| import { IClientFactory, CreatePRCommentTask } from '../Src/task'; | |
| : | |
| rewiremock.disable(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment