test: fix coverage (#3990)

This commit is contained in:
Rhys Arkins 2019-07-01 14:18:20 +02:00 committed by GitHub
parent 714d4b77f9
commit 70857bfc5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 38 deletions

View file

@ -112,8 +112,9 @@ export function getRepoForceRebase() {
return false; return false;
} }
// istanbul ignore next export /* istanbul ignore next */ async function setBaseBranch(
export async function setBaseBranch(branchName = config.baseBranch) { branchName = config.baseBranch
) {
logger.debug(`Setting baseBranch to ${branchName}`); logger.debug(`Setting baseBranch to ${branchName}`);
config.baseBranch = branchName; config.baseBranch = branchName;
delete config.baseCommitSHA; delete config.baseCommitSHA;
@ -122,70 +123,67 @@ export async function setBaseBranch(branchName = config.baseBranch) {
await getFileList(branchName); await getFileList(branchName);
} }
// istanbul ignore next export /* istanbul ignore next */ function setBranchPrefix(
export function setBranchPrefix(branchPrefix: string) { branchPrefix: string
) {
return config.storage.setBranchPrefix(branchPrefix); return config.storage.setBranchPrefix(branchPrefix);
} }
// Search // Search
// istanbul ignore next export /* istanbul ignore next */ function getFileList(branchName: string) {
export function getFileList(branchName: string) {
return config.storage.getFileList(branchName); return config.storage.getFileList(branchName);
} }
// Branch // Branch
// istanbul ignore next export /* istanbul ignore next */ function branchExists(branchName: string) {
export function branchExists(branchName: string) {
return config.storage.branchExists(branchName); return config.storage.branchExists(branchName);
} }
// istanbul ignore next export /* istanbul ignore next */ function getAllRenovateBranches(
export function getAllRenovateBranches(branchPrefix: string) { branchPrefix: string
) {
return config.storage.getAllRenovateBranches(branchPrefix); return config.storage.getAllRenovateBranches(branchPrefix);
} }
// istanbul ignore next export /* istanbul ignore next */ function isBranchStale(branchName: string) {
export function isBranchStale(branchName: string) {
return config.storage.isBranchStale(branchName); return config.storage.isBranchStale(branchName);
} }
// istanbul ignore next export /* istanbul ignore next */ function getFile(
export function getFile(filePath: string, branchName: string) { filePath: string,
branchName: string
) {
return config.storage.getFile(filePath, branchName); return config.storage.getFile(filePath, branchName);
} }
// istanbul ignore next export /* istanbul ignore next */ async function deleteBranch(
export async function deleteBranch(
branchName: string, branchName: string,
abandonAssociatedPr = false abandonAssociatedPr = false
) { ) {
await config.storage.deleteBranch(branchName); await config.storage.deleteBranch(branchName);
// istanbul ignore if
if (abandonAssociatedPr) { if (abandonAssociatedPr) {
const pr = await getBranchPr(branchName); const pr = await getBranchPr(branchName);
await abandonPr(pr.number); await abandonPr(pr.number);
} }
} }
// istanbul ignore next export /* istanbul ignore next */ function getBranchLastCommitTime(
export function getBranchLastCommitTime(branchName: string) { branchName: string
) {
return config.storage.getBranchLastCommitTime(branchName); return config.storage.getBranchLastCommitTime(branchName);
} }
// istanbul ignore next export /* istanbul ignore next */ function getRepoStatus() {
export function getRepoStatus() {
return config.storage.getRepoStatus(); return config.storage.getRepoStatus();
} }
// istanbul ignore next export /* istanbul ignore next */ function mergeBranch(branchName: string) {
export function mergeBranch(branchName: string) {
return config.storage.mergeBranch(branchName); return config.storage.mergeBranch(branchName);
} }
// istanbul ignore next export /* istanbul ignore next */ function commitFilesToBranch(
export function commitFilesToBranch(
branchName: string, branchName: string,
files: any[], files: any[],
message: string, message: string,
@ -199,8 +197,7 @@ export function commitFilesToBranch(
); );
} }
// istanbul ignore next export /* istanbul ignore next */ function getCommitMessages() {
export function getCommitMessages() {
return config.storage.getCommitMessages(); return config.storage.getCommitMessages();
} }
@ -477,21 +474,17 @@ export function getPrBody(input: string) {
.replace('</details>', ''); .replace('</details>', '');
} }
// istanbul ignore next export /* istanbul ignore next */ function findIssue() {
export function findIssue() {
logger.warn(`findIssue() is not implemented`); logger.warn(`findIssue() is not implemented`);
} }
// istanbul ignore next export /* istanbul ignore next */ function ensureIssue() {
export function ensureIssue() {
logger.warn(`ensureIssue() is not implemented`); logger.warn(`ensureIssue() is not implemented`);
} }
// istanbul ignore next export /* istanbul ignore next */ function ensureIssueClosing() {}
export function ensureIssueClosing() {}
// istanbul ignore next export /* istanbul ignore next */ function getIssueList() {
export function getIssueList() {
logger.debug(`getIssueList()`); logger.debug(`getIssueList()`);
// TODO: Needs implementation // TODO: Needs implementation
return []; return [];
@ -573,8 +566,10 @@ export async function addReviewers(prNo: number, reviewers: string[]) {
); );
} }
// istanbul ignore next export /* istanbul ignore next */ async function deleteLabel(
export async function deleteLabel(prNumber: number, label: string) { prNumber: number,
label: string
) {
logger.debug(`Deleting label ${label} from #${prNumber}`); logger.debug(`Deleting label ${label} from #${prNumber}`);
const azureApiGit = await azureApi.gitApi(); const azureApiGit = await azureApi.gitApi();
await azureApiGit.deletePullRequestLabels(config.repoId, prNumber, label); await azureApiGit.deletePullRequestLabels(config.repoId, prNumber, label);

View file

@ -722,7 +722,7 @@ async function getIssueList() {
if (!config.issueList) { if (!config.issueList) {
logger.debug('Retrieving issueList'); logger.debug('Retrieving issueList');
const filterBySupportMinimumGheVersion = '2.17.0'; const filterBySupportMinimumGheVersion = '2.17.0';
// istanbul ignore if // istanbul ignore next
if ( if (
config.enterpriseVersion && config.enterpriseVersion &&
semver.lt(config.enterpriseVersion, filterBySupportMinimumGheVersion) semver.lt(config.enterpriseVersion, filterBySupportMinimumGheVersion)