From a0319d9bb940f83d3c971a8e1ec922ac00b7bfb8 Mon Sep 17 00:00:00 2001 From: MuriloChianfa Date: Thu, 7 Dec 2023 06:04:41 -0300 Subject: [PATCH] trying to fix tests on pipeline --- .prettierignore | 3 ++- __tests__/main.test.js | 25 ++++++++++++++++++++----- badges/coverage.svg | 2 +- dist/package.json | 4 +++- src/evaluation.js | 5 ++++- src/inputs/encoder-version.js | 3 ++- src/inputs/php-target-version.js | 3 ++- 7 files changed, 34 insertions(+), 11 deletions(-) diff --git a/.prettierignore b/.prettierignore index 64f046d..b0beda5 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,4 @@ dist/ node_modules/ -coverage/ \ No newline at end of file +coverage/ +encrypted/ \ No newline at end of file diff --git a/__tests__/main.test.js b/__tests__/main.test.js index 9864aa8..4e715ba 100644 --- a/__tests__/main.test.js +++ b/__tests__/main.test.js @@ -23,10 +23,22 @@ describe('action', () => { expect(runMock).toHaveReturned() // Verify that all of the core library functions were called correctly with default values - expect(debugMock).toHaveBeenNthCalledWith(1, 'Encoding files using template: laravel') - expect(debugMock).toHaveBeenNthCalledWith(2, 'Using encoder version: current') - expect(debugMock).toHaveBeenNthCalledWith(3, 'Using PHP target version: 8.2') - expect(debugMock).toHaveBeenNthCalledWith(4, 'Using target architecture: x86-64') + expect(debugMock).toHaveBeenNthCalledWith( + 1, + 'Encoding files using template: laravel' + ) + expect(debugMock).toHaveBeenNthCalledWith( + 2, + 'Using encoder version: current' + ) + expect(debugMock).toHaveBeenNthCalledWith( + 3, + 'Using PHP target version: 8.2' + ) + expect(debugMock).toHaveBeenNthCalledWith( + 4, + 'Using target architecture: x86-64' + ) expect(debugMock).toHaveBeenNthCalledWith(5, 'Using input files: .') expect(debugMock).toHaveBeenNthCalledWith(6, 'Using output path: encrypted') @@ -35,6 +47,9 @@ describe('action', () => { expect(debugMock).toHaveBeenNthCalledWith(8, '') expect(debugMock).toHaveBeenNthCalledWith(9, '') - expect(setOutputMock).toHaveBeenCalledWith('status', 'Project encoded with success') + expect(setOutputMock).toHaveBeenCalledWith( + 'status', + 'Project encoded with success' + ) }, 20000) }) diff --git a/badges/coverage.svg b/badges/coverage.svg index 6e95813..f5d8348 100644 --- a/badges/coverage.svg +++ b/badges/coverage.svg @@ -1 +1 @@ -Coverage: 91.86%Coverage91.86% \ No newline at end of file +Coverage: 87.8%Coverage87.8% \ No newline at end of file diff --git a/dist/package.json b/dist/package.json index 9e26dfe..3dbc1ca 100644 --- a/dist/package.json +++ b/dist/package.json @@ -1 +1,3 @@ -{} \ No newline at end of file +{ + "type": "module" +} diff --git a/src/evaluation.js b/src/evaluation.js index 18b58c4..9e7472d 100644 --- a/src/evaluation.js +++ b/src/evaluation.js @@ -13,7 +13,10 @@ module.exports = async function evaluation() { const cwd = process.cwd() if (!fs.existsSync('ioncube_encoder_evaluation')) { - await download('https://www.ioncube.com/eval_linux', `${cwd}/ioncube_encoder_evaluation.tar.gz`) + await download( + 'https://www.ioncube.com/eval_linux', + `${cwd}/ioncube_encoder_evaluation.tar.gz` + ) await tar.extract({ file: `${cwd}/ioncube_encoder_evaluation.tar.gz` }) if (fs.existsSync(`${cwd}/ioncube_encoder_evaluation.tar.gz`)) { diff --git a/src/inputs/encoder-version.js b/src/inputs/encoder-version.js index da226fd..8e95c24 100644 --- a/src/inputs/encoder-version.js +++ b/src/inputs/encoder-version.js @@ -5,7 +5,8 @@ const core = require('@actions/core') * @returns {string} Returns a validated encoder-version input. */ module.exports = function validateEncoderVersion(standard = 'current') { - let encoderVersion = core.getInput('encoder-version', { required: true }) ?? standard + let encoderVersion = + core.getInput('encoder-version', { required: true }) ?? standard core.debug(`Using encoder version: ${encoderVersion}`) diff --git a/src/inputs/php-target-version.js b/src/inputs/php-target-version.js index 86e10f5..7586f33 100644 --- a/src/inputs/php-target-version.js +++ b/src/inputs/php-target-version.js @@ -5,7 +5,8 @@ const core = require('@actions/core') * @returns {string} Returns a validated php-target-version input. */ module.exports = function validatePhpTargetVersion(standard = '8.2') { - let phpTargetVersion = core.getInput('php-target-version', { required: true }) ?? standard + let phpTargetVersion = + core.getInput('php-target-version', { required: true }) ?? standard core.debug(`Using PHP target version: ${phpTargetVersion}`)