Skip to content

Commit

Permalink
test: add inital test for ai:models:detach
Browse files Browse the repository at this point in the history
  • Loading branch information
k80bowman committed Sep 25, 2024
1 parent 6326dfd commit 975c6c2
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/commands/ai/models/detach.test.ts
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())
})
})

0 comments on commit 975c6c2

Please sign in to comment.