From d54d35217c1cad0496f7e3df1a78e9c1e092b526 Mon Sep 17 00:00:00 2001 From: srmukher Date: Wed, 22 Nov 2023 14:15:45 +0530 Subject: [PATCH] Test action --- tools/UnitTestApp/action.yml | 13 ++++++ tools/UnitTestApp/dist/index.js | 80 +++++++++++++++++++++++++++++++++ tools/UnitTestApp/index.js | 15 +++++++ tools/UnitTestApp/package.json | 30 +++++++++---- 4 files changed, 129 insertions(+), 9 deletions(-) create mode 100644 tools/UnitTestApp/action.yml create mode 100644 tools/UnitTestApp/dist/index.js create mode 100644 tools/UnitTestApp/index.js diff --git a/tools/UnitTestApp/action.yml b/tools/UnitTestApp/action.yml new file mode 100644 index 0000000000..0af28bb471 --- /dev/null +++ b/tools/UnitTestApp/action.yml @@ -0,0 +1,13 @@ +name: 'Hello World' +description: 'Greet someone and record the time' +inputs: + who-to-greet: # id of input + description: 'Who to greet' + required: true + default: 'World' +outputs: + time: # id of output + description: 'The time we greeted you' +runs: + using: 'node20' + main: 'dist/index.js' \ No newline at end of file diff --git a/tools/UnitTestApp/dist/index.js b/tools/UnitTestApp/dist/index.js new file mode 100644 index 0000000000..a4070dc849 --- /dev/null +++ b/tools/UnitTestApp/dist/index.js @@ -0,0 +1,80 @@ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 768: +/***/ ((module) => { + +module.exports = eval("require")("@actions/core"); + + +/***/ }), + +/***/ 438: +/***/ ((module) => { + +module.exports = eval("require")("@actions/github"); + + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __nccwpck_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ var threw = true; +/******/ try { +/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); +/******/ threw = false; +/******/ } finally { +/******/ if(threw) delete __webpack_module_cache__[moduleId]; +/******/ } +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat */ +/******/ +/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +const core = __nccwpck_require__(768); +const github = __nccwpck_require__(438); + +try { + // `who-to-greet` input defined in action metadata file + const nameToGreet = core.getInput('who-to-greet'); + console.log(`Hello ${nameToGreet}!`); + const time = (new Date()).toTimeString(); + core.setOutput("time", time); + // Get the JSON webhook payload for the event that triggered the workflow + const payload = JSON.stringify(github.context.payload, undefined, 2) + console.log(`The event payload: ${payload}`); +} catch (error) { + core.setFailed(error.message); +} +})(); + +module.exports = __webpack_exports__; +/******/ })() +; \ No newline at end of file diff --git a/tools/UnitTestApp/index.js b/tools/UnitTestApp/index.js new file mode 100644 index 0000000000..5767cf1e72 --- /dev/null +++ b/tools/UnitTestApp/index.js @@ -0,0 +1,15 @@ +const core = require('@actions/core'); +const github = require('@actions/github'); + +try { + // `who-to-greet` input defined in action metadata file + const nameToGreet = core.getInput('who-to-greet'); + console.log(`Hello ${nameToGreet}!`); + const time = (new Date()).toTimeString(); + core.setOutput("time", time); + // Get the JSON webhook payload for the event that triggered the workflow + const payload = JSON.stringify(github.context.payload, undefined, 2) + console.log(`The event payload: ${payload}`); +} catch (error) { + core.setFailed(error.message); +} \ No newline at end of file diff --git a/tools/UnitTestApp/package.json b/tools/UnitTestApp/package.json index 11176986e3..8438300dd1 100644 --- a/tools/UnitTestApp/package.json +++ b/tools/UnitTestApp/package.json @@ -11,25 +11,37 @@ "test": "jest" }, "devDependencies": { - "jest": "29.7.0", - "@types/jest": "29.5.5", + "@fluentui/react-charting": "*", + "@fluentui/theme-samples": "^8.7.119", "@testing-library/dom": "8.11.3", "@testing-library/jest-dom": "5.16.5", "@testing-library/react": "12.1.2", - "react": "17.0.2", - "react-dom": "17.0.2", - "react-test-renderer": "17.0.2", + "@types/fs-extra": "8.0.1", + "@types/jest": "29.5.5", + "@types/node": "16.11.7", "@types/react": "17.0.44", + "@types/react-addons-test-utils": "0.14.18", "@types/react-dom": "17.0.15", "@types/react-test-renderer": "17.0.2", - "@types/react-addons-test-utils": "0.14.18", + "@types/rewire": "^2.5.28", "fs-extra": "8.1.0", - "@types/fs-extra": "8.0.1", + "jest": "29.7.0", + "react": "17.0.2", + "react-dom": "17.0.2", + "react-test-renderer": "17.0.2", "rewire": "^4.0.1", - "@types/rewire": "^2.5.28", - "@fluentui/react-charting": "5.18.17" + "typescript": "4.4.4" }, "exports": { "./README.md": "./README.md" + }, + "jest": { + "setupFilesAfterEnv": [ + "/jest.setup.js" + ] + }, + "dependencies": { + "@actions/core": "^1.10.1", + "@actions/github": "^6.0.0" } } \ No newline at end of file