All files / src/modules promotePackage.js

100% Statements 2/2
100% Branches 0/0
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26                        1x             1x            
/**
 * Promote a package.
 * @module src/modules/promotePackage
 * @param {Object} options - Promote package options.
 * @param {string} options.sourceRepo - The fully-qualified name for the source repository, i.e., 'username/sourcerepo'.
 * @param {string} options.destination - The fully-qualified destination repository name, i.e., 'username/destrepo'.
 * @param {string} options.distroFqname - The fully-qualified distribution/version, i.e., 'ubuntu/precise'.
 * @param {string} options.group - The name of the group this package belongs to for Java packages.
 * @param {string} options.scope - The package scope. Required if deleting a scoped Node.JS package
 * @param {string} options.filename - The filename of the package.
 */
export default (request, options) => {
  let url = [options.baseUrl + "repos",
             options.sourceRepo,
             options.distroFqname,
             options.group,
             options.filename,
             "promote.json"].filter(Boolean).join("/");
 
  return request
    .post(url)
    .send({ destination: options.destination,
            group: options.group,
            scope: options.scope });
}