Skip to content

Commit

Permalink
Remove input parameter that isn't one (in tests) (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ferraz-oliveira authored Jun 22, 2024
1 parent da545dd commit 31b1b6d
Showing 1 changed file with 19 additions and 25 deletions.
44 changes: 19 additions & 25 deletions test/setup-beam.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,21 +181,21 @@ async function testOTPVersions() {
spec = '26'
osVersion = 'ubuntu-24.04'
expected = 'maint-26'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)

simulateInput('version-type', before)
spec = '27.0'
osVersion = 'ubuntu-24.04'
expected = 'OTP-27.0'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)

simulateInput('version-type', before)
spec = '25.3.2.1'
osVersion = 'ubuntu-20.04'
expected = 'OTP-25.3.2.1'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)
simulateInput('version-type', before)

Expand Down Expand Up @@ -226,7 +226,7 @@ async function testOTPVersions() {
spec = '20.3.8.26'
osVersion = 'ubuntu-20.04'
expected = 'OTP-20.3.8.26'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)

spec = '20.x'
Expand All @@ -250,13 +250,13 @@ async function testOTPVersions() {
spec = 'maint'
osVersion = 'ubuntu-22.04'
expected = 'maint'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)

spec = 'master'
osVersion = 'ubuntu-22.04'
expected = 'master'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)

process.env.RUNNER_ARCH = previousRunnerArch
Expand Down Expand Up @@ -306,21 +306,21 @@ async function testLinuxARM64OTPVersions() {
spec = '26'
osVersion = 'ubuntu-24.04'
expected = 'maint-26'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)

simulateInput('version-type', before)
spec = '27.0'
osVersion = 'ubuntu-24.04'
expected = 'OTP-27.0'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)

simulateInput('version-type', before)
spec = '25.3.2.1'
osVersion = 'ubuntu-20.04'
expected = 'OTP-25.3.2.1'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)
simulateInput('version-type', before)

Expand All @@ -333,7 +333,7 @@ async function testLinuxARM64OTPVersions() {
spec = '20.3.8.26'
osVersion = 'ubuntu-20.04'
expected = 'OTP-20.3.8.26'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)

spec = '20.x'
Expand All @@ -357,13 +357,13 @@ async function testLinuxARM64OTPVersions() {
spec = 'maint'
osVersion = 'ubuntu-22.04'
expected = 'maint'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)

spec = 'master'
osVersion = 'ubuntu-22.04'
expected = 'master'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)
}

Expand Down Expand Up @@ -391,21 +391,21 @@ async function testLinuxAMD64OTPVersions() {
spec = '26'
osVersion = 'ubuntu-24.04'
expected = 'maint-26'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)

simulateInput('version-type', before)
spec = '27.0'
osVersion = 'ubuntu-24.04'
expected = 'OTP-27.0'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)

simulateInput('version-type', before)
spec = '25.3.2.1'
osVersion = 'ubuntu-20.04'
expected = 'OTP-25.3.2.1'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)

simulateInput('version-type', before)
Expand Down Expand Up @@ -436,7 +436,7 @@ async function testLinuxAMD64OTPVersions() {
spec = '20.3.8.26'
osVersion = 'ubuntu-20.04'
expected = 'OTP-20.3.8.26'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)

spec = '20.x'
Expand All @@ -460,26 +460,20 @@ async function testLinuxAMD64OTPVersions() {
spec = 'maint'
osVersion = 'ubuntu-22.04'
expected = 'maint'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)

spec = 'master'
osVersion = 'ubuntu-22.04'
expected = 'master'
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)
}

simulateInput('hexpm-mirrors', hexMirrors, { multiline: true })
}

async function testFailGetOTPVersion() {
const hexMirrors = simulateInput(
'hexpm-mirrors',
'https://repo.hex.pm, https://cdn.jsdelivr.net/hex',
{ multiline: true },
)

const previousRunnerArch = process.env.RUNNER_ARCH
process.env.RUNNER_ARCH = 'invalid'

Expand All @@ -489,7 +483,7 @@ async function testFailGetOTPVersion() {

assert.rejects(
async () => {
await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
await setupBeam.getOTPVersion(spec, osVersion)
},
(err) => {
assert.ok(err instanceof Error)
Expand Down

0 comments on commit 31b1b6d

Please sign in to comment.