Skip to content

Commit

Permalink
fixing tests on pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
MuriloChianfa committed Dec 7, 2023
1 parent b67e200 commit 9ccd2c0
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 14 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ lib/
dist/
node_modules/
coverage/
encrypted/
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ jobs:
id: test-action
uses: ./
with:
milliseconds: 1000
template: 'laravel'

- name: Print Output
id: output
run: echo "${{ steps.test-action.outputs.time }}"
run: echo "${{ steps.test-action.outputs.status }}"
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
node_modules/
coverage/
coverage/
encrypted/
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{

Check warning on line 1 in .prettierrc.json

View workflow job for this annotation

GitHub Actions / Lint Codebase

File ignored by default.
"printWidth": 120,
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
Expand Down
25 changes: 20 additions & 5 deletions __tests__/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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)
})
4 changes: 2 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/evaluation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`)) {
Expand Down
3 changes: 2 additions & 1 deletion src/inputs/encoder-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)

Expand Down
3 changes: 2 additions & 1 deletion src/inputs/php-target-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)

Expand Down

0 comments on commit 9ccd2c0

Please sign in to comment.