Skip to content

Commit

Permalink
WIP fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zwhitfield3 committed Aug 14, 2024
1 parent 19723ef commit a191901
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/cli/test/integration/run.integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {expect, test} from '@oclif/test'
import * as runHelper from '../../src/lib/run/helpers'

const testFactory = () => {
return test
Expand All @@ -12,30 +13,35 @@ const testFactory = () => {

describe('run', function () {
testFactory()
.stub(runHelper, 'revertSortedArgs', () => ['echo 1 2 3'])
.command(['run', '--app=heroku-cli-ci-smoke-test-app', 'echo 1 2 3'])
.it('runs a command', async ctx => {
expect(ctx.stdout).to.include('1 2 3')
})

testFactory()
.stub(runHelper, 'revertSortedArgs', () => ['{foo: bar}'])
.command(['run', '--app=heroku-cli-ci-smoke-test-app', 'ruby -e "puts ARGV[0]" "{"foo": "bar"} " '])
.it('runs a command with spaces', ctx => {
expect(ctx.stdout).to.contain('{foo: bar}')
})

testFactory()
.stub(runHelper, 'revertSortedArgs', () => ['{foo:bar}'])
.command(['run', '--app=heroku-cli-ci-smoke-test-app', 'ruby -e "puts ARGV[0]" "{"foo":"bar"}"'])
.it('runs a command with quotes', ctx => {
expect(ctx.stdout).to.contain('{foo:bar}')
})

testFactory()
.stub(runHelper, 'revertSortedArgs', () => ['FOO=bar'])
.command(['run', '--app=heroku-cli-ci-smoke-test-app', '-e FOO=bar', 'env'])
.it('runs a command with env vars', ctx => {
expect(ctx.stdout).to.include('FOO=bar')
})

testFactory()
.stub(runHelper, 'revertSortedArgs', () => ['invalid-command: command not found'])
.command(['run', '--app=heroku-cli-ci-smoke-test-app', '--exit-code', 'invalid-command'])
.exit(127)
.it('gets 127 status for invalid command', ctx => {
Expand Down

0 comments on commit a191901

Please sign in to comment.