Skip to content

Commit

Permalink
Format modules
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Jul 21, 2021
1 parent abd3c73 commit eeb4126
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 10 deletions.
13 changes: 12 additions & 1 deletion lib/util.js
Expand Up @@ -87,4 +87,15 @@ const parseVersion = raw => {

const e = (message, docs) => new Error(docs ? `${message}${EOL}Documentation: ${docs}${EOL}` : message);

export { getSystemInfo, clean, format, truncateLines, rejectAfter, reduceUntil, parseGitUrl, hasAccess, parseVersion, e };
export {
getSystemInfo,
clean,
format,
truncateLines,
rejectAfter,
reduceUntil,
parseGitUrl,
hasAccess,
parseVersion,
e
};
9 changes: 8 additions & 1 deletion test/github.js
Expand Up @@ -3,7 +3,14 @@ import sinon from 'sinon';
import { RequestError } from '@octokit/request-error';
import GitHub from '../lib/plugin/github/GitHub';
import { factory, runTasks } from './util';
import { interceptAuthentication, interceptCollaborator, interceptListReleases, interceptCreate, interceptUpdate, interceptAsset } from './stub/github';
import {
interceptAuthentication,
interceptCollaborator,
interceptListReleases,
interceptCreate,
interceptUpdate,
interceptAsset
} from './stub/github';

const tokenRef = 'GITHUB_TOKEN';
const pushRepo = 'git://github.com:user/repo';
Expand Down
8 changes: 7 additions & 1 deletion test/gitlab.js
Expand Up @@ -2,7 +2,13 @@ import test from 'ava';
import sinon from 'sinon';
import nock from 'nock';
import GitLab from '../lib/plugin/gitlab/GitLab';
import { interceptUser, interceptCollaborator, interceptCollaboratorFallback, interceptPublish, interceptAsset } from './stub/gitlab';
import {
interceptUser,
interceptCollaborator,
interceptCollaboratorFallback,
interceptPublish,
interceptAsset
} from './stub/gitlab';
import { factory, runTasks } from './util';

const tokenHeader = 'Private-Token';
Expand Down
9 changes: 8 additions & 1 deletion test/stub/github.js
Expand Up @@ -104,4 +104,11 @@ const interceptAsset = ({
};
});

export { interceptAuthentication, interceptCollaborator, interceptListReleases, interceptCreate, interceptUpdate, interceptAsset };
export {
interceptAuthentication,
interceptCollaborator,
interceptListReleases,
interceptCreate,
interceptUpdate,
interceptAsset
};
6 changes: 2 additions & 4 deletions test/stub/gitlab.js
Expand Up @@ -19,10 +19,8 @@ export let interceptCollaboratorFallback = (
.get(`/api/v4/projects/${group ? `${group}%2F` : ''}${owner}%2F${project}/members/${userId}`)
.reply(200, { id: userId, username: owner, access_level: 30 });

export let interceptPublish = (
{ host = 'https://gitlab.com', owner = 'user', project = 'repo', body } = {},
options
) => nock(host, options).post(`/api/v4/projects/${owner}%2F${project}/releases`, body).reply(200, {});
export let interceptPublish = ({ host = 'https://gitlab.com', owner = 'user', project = 'repo', body } = {}, options) =>
nock(host, options).post(`/api/v4/projects/${owner}%2F${project}/releases`, body).reply(200, {});

export let interceptAsset = ({ host = 'https://gitlab.com', owner = 'user', project = 'repo' } = {}) =>
nock(host)
Expand Down
14 changes: 12 additions & 2 deletions test/tasks.js
Expand Up @@ -11,8 +11,18 @@ import runTasks from '../lib/tasks';
import Plugin from '../lib/plugin/Plugin';
import { mkTmpDir, gitAdd, getArgs } from './util/helpers';
import ShellStub from './stub/shell';
import { interceptUser as interceptGitLabUser, interceptCollaborator as interceptGitLabCollaborator, interceptPublish as interceptGitLabPublish, interceptAsset as interceptGitLabAsset } from './stub/gitlab';
import { interceptAuthentication as interceptGitHubAuthentication, interceptCollaborator as interceptGitHubCollaborator, interceptCreate as interceptGitHubCreate, interceptAsset as interceptGitHubAsset } from './stub/github';
import {
interceptUser as interceptGitLabUser,
interceptCollaborator as interceptGitLabCollaborator,
interceptPublish as interceptGitLabPublish,
interceptAsset as interceptGitLabAsset
} from './stub/gitlab';
import {
interceptAuthentication as interceptGitHubAuthentication,
interceptCollaborator as interceptGitHubCollaborator,
interceptCreate as interceptGitHubCreate,
interceptAsset as interceptGitHubAsset
} from './stub/github';

const noop = Promise.resolve();

Expand Down

0 comments on commit eeb4126

Please sign in to comment.