Skip to content

Commit

Permalink
Adding a test
Browse files Browse the repository at this point in the history
  • Loading branch information
patoroco committed Oct 13, 2023
1 parent 30e6e98 commit b2e5f06
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 13 deletions.
18 changes: 15 additions & 3 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,20 @@

// //TODO: test what happens when the connection fails

describe('dummy', () => {
it('test', () => {
console.log('Dummy test')
/**
* Unit tests for the action's entrypoint, src/index.ts
*/

import * as main from '../src/main'

// Mock the action's entrypoint
const runMock = jest.spyOn(main, 'run').mockImplementation()

describe('index', () => {
it('calls run when imported', async () => {
// eslint-disable-next-line @typescript-eslint/no-require-imports
require('../src/index')

expect(runMock).toHaveBeenCalled()
})
})
63 changes: 56 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,71 @@
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({

/***/ 399:
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.run = void 0;
async function run() {
console.log('PEPE');
}
exports.run = run;


/***/ })

/******/ });
/************************************************************************/
/******/ // 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 uses a non-standard name for the exports (exports).
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
var exports = __webpack_exports__;

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.run = void 0;
async function run() {
console.log('PEPE');
}
exports.run = run;
run();
/**
* The entrypoint for the action.
*/
const main_1 = __nccwpck_require__(399);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
(0, main_1.run)();

})();

Expand Down
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export async function run(): Promise<void> {
console.log('PEPE')
}
/**
* The entrypoint for the action.
*/
import { run } from './main'

// eslint-disable-next-line @typescript-eslint/no-floating-promises
run()
5 changes: 5 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as core from '@actions/core'

export async function run(): Promise<void> {
console.log('PEPE')
}

0 comments on commit b2e5f06

Please sign in to comment.