Add some simple unit tests

This commit is contained in:
Jonathan Clem
2022-02-01 22:08:12 +00:00
committed by GitHub
parent 03fb990f28
commit b39b67e25e
8 changed files with 342 additions and 138 deletions

53
dist/index.js generated vendored
View File

@@ -1,7 +1,7 @@
require('./sourcemap-register.js');/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 3109:
/***/ 6672:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
@@ -35,12 +35,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.addToProject = void 0;
const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438));
// TODO: Ensure this (and the Octokit client) works for non-github.com URLs, as well.
// https://github.com/orgs|users/<ownerName>/projects/<projectNumber>
const urlParse = /^(?:https:\/\/)?github\.com\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/;
function run() {
function addToProject() {
var _a, _b, _c, _d, _e, _f, _g, _h;
return __awaiter(this, void 0, void 0, function* () {
const projectUrl = core.getInput('project-url', { required: true });
@@ -104,14 +105,7 @@ function run() {
core.setOutput('itemId', addResp.addProjectNextItem.projectNextItem.id);
});
}
run()
.catch(err => {
core.setFailed(err.message);
process.exit(1);
})
.then(() => {
process.exit(0);
});
exports.addToProject = addToProject;
function mustGetOwnerTypeQuery(ownerType) {
const ownerTypeQuery = ownerType === 'orgs' ? 'organization' : ownerType === 'users' ? 'user' : null;
if (!ownerTypeQuery) {
@@ -121,6 +115,45 @@ function mustGetOwnerTypeQuery(ownerType) {
}
/***/ }),
/***/ 3109:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
const core = __importStar(__nccwpck_require__(2186));
const add_to_project_1 = __nccwpck_require__(6672);
(0, add_to_project_1.addToProject)()
.catch(err => {
core.setFailed(err.message);
process.exit(1);
})
.then(() => {
process.exit(0);
});
/***/ }),
/***/ 7351: