-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add inital test for ai:models:detach
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {stdout, stderr} from 'stdout-stderr' | ||
import Cmd from '../../../../src/commands/ai/models/detach' | ||
import {runCommand} from '../../../run-command' | ||
import nock from 'nock' | ||
import {expect} from 'chai' | ||
|
||
describe('addons:detach', function () { | ||
afterEach(nock.cleanAll) | ||
|
||
it('detaches an add-on', function () { | ||
const api = nock('https://api.heroku.com:443') | ||
.get('/apps/myapp/addon-attachments/redis-123') | ||
.reply(200, {id: 100, name: 'redis-123', addon: {name: 'redis'}}) | ||
.delete('/addon-attachments/100') | ||
.reply(200) | ||
.get('/apps/myapp/releases') | ||
.reply(200, [{version: 10}]) | ||
|
||
return runCommand(Cmd, ['--app', 'myapp', 'redis-123']) | ||
.then(() => { | ||
expect(stdout.output).to.equal('') | ||
expect(stderr.output).to.contain('Detaching redis-123 to redis from myapp... done\n') | ||
expect(stderr.output).to.contain('Unsetting redis-123 config vars and restarting myapp... done, v10\n') | ||
}) | ||
.then(() => api.done()) | ||
}) | ||
}) |