All files / src/modules deletePackage.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                          1x           1x      
/**
 * Delete a package.
 * @module src/modules/deletePackage
 * @param {Object} superagent request object.
 * @param {Object} options - Promote package options.
 * @param {string} options.repository - The fully-qualified name for the source repository, i.e., 'username/sourcerepo'.
 * @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.
 * @return {Promise} The superagent promise object.
 */
export default (request, options) => {
  let url = [options.baseUrl + "repos",
             options.repository,
             options.distroFqname,
             options.group,
             options.filename].filter(Boolean).join("/");
  
  return request.delete(url)
    .send({ scope: options.scope });
}