Skip to content

Commit c035df1

Browse files
committed
test: migrate features/enable to @oclif/test v4
1 parent 15a5819 commit c035df1

File tree

2 files changed

+33
-32
lines changed

2 files changed

+33
-32
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import {runCommand} from '@oclif/test'
2+
import {expect} from 'chai'
3+
import nock from 'nock'
4+
import stripAnsi from 'strip-ansi'
5+
6+
describe('features:enable', function () {
7+
afterEach(() => nock.cleanAll())
8+
9+
it('enables an app feature', async () => {
10+
nock('https://api.heroku.com:443')
11+
.get('/apps/myapp/features/feature-a')
12+
.reply(200, {enabled: false})
13+
.patch('/apps/myapp/features/feature-a', {enabled: true})
14+
.reply(200)
15+
16+
const {stdout, stderr} = await runCommand(['features:enable', 'feature-a', '--app', 'myapp'])
17+
18+
expect(stdout).to.equal('')
19+
expect(stderr).to.contain('Enabling feature-a for')
20+
expect(stderr).to.contain('myapp')
21+
expect(stderr).to.contain('done')
22+
})
23+
24+
it('errors if feature is already enabled', async () => {
25+
nock('https://api.heroku.com:443')
26+
.get('/apps/myapp/features/feature-a')
27+
.reply(200, {enabled: true})
28+
29+
const {error} = await runCommand(['features:enable', '-a', 'myapp', 'feature-a'])
30+
31+
expect(stripAnsi(error?.message || '')).to.equal('feature-a is already enabled.')
32+
})
33+
})

packages/cli/test/unit/commands/features/enable.unit.test.ts.skip

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)