Skip to content

Commit

Permalink
WIP test
Browse files Browse the repository at this point in the history
  • Loading branch information
zwhitfield3 committed Apr 25, 2024
1 parent 956737c commit ebc083b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/commands/auth/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ By default, the CLI auth token is only valid for 1 year. To generate a long-live
if (token && token.access_token.expires_in) {
const d = new Date()
d.setSeconds(d.getSeconds() + token.access_token.expires_in)
this.warn(`token will expire ${formatRelative(d, new Date())}\n${isInternal ? 'All tokens expire one year after we generate it.' : `To generate a token that expires in one year, use ${color.cmd('heroku authorizations:create')}.`}`)
this.warn(`token will expire ${formatRelative(d, new Date())}\n${isInternal ? 'All tokens expire one year after we generate it.' : `To generate, use ${color.cmd('heroku authorizations:create')}.`}`)
}
} catch (error: any) {
this.warn(error)
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/unit/commands/auth/token.unit.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {expect, test} from '@oclif/test'
// import stripAnsi from 'strip-ansi'

describe('auth:token', () => {
test
Expand Down Expand Up @@ -34,7 +35,7 @@ describe('auth:token', () => {
.command(['auth:token'])
.it('shows "long-term" token generation warning for non-internal users', ctx => {
expect(ctx.stdout).to.equal('foobar\n')
expect(ctx.stderr).to.contain('To generate a token that expires in one year, use heroku authorizations:create.')
expect(ctx.stderr).to.contain('To generate, use heroku authorizations:create.')
expect(ctx.stderr).to.not.contain('All tokens expire one year after we generate it.')
})

Expand Down

0 comments on commit ebc083b

Please sign in to comment.