UNPKG

910 BJavaScriptView Raw
1/* eslint-env mocha */
2
3const nock = require('nock')
4const expect = require('chai').expect
5const cli = require('heroku-cli-util')
6const cmd = require('../../../commands/ci/config-set')
7
8describe('heroku ci:config:set', function () {
9 let app, coupling, key, value
10
11 beforeEach(function () {
12 cli.mockConsole()
13 app = '123-app'
14 key = 'FOO'
15 value = 'bar'
16
17 coupling = {
18 pipeline: {
19 id: '123-abc',
20 name: 'test-pipeline'
21 }
22 }
23 })
24
25 it('sets new config', function* () {
26 const api = nock('https://api.heroku.com')
27 .get(`/apps/${app}/pipeline-couplings`)
28 .reply(200, coupling)
29 .patch(`/pipelines/${coupling.pipeline.id}/stage/test/config-vars`)
30 .reply(200, { [key]: value })
31
32 yield cmd.run({ app, args: [ `${key}=${value}` ] })
33
34 expect(cli.stdout).to.include(key)
35 expect(cli.stdout).to.include(value)
36
37 api.done()
38 })
39})