Skip to content

Commit

Permalink
fix(command-status): fix typo Github -> GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
erezrokah committed Jul 27, 2021
1 parent cb688df commit 6796a5b
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/commands/status/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class StatusCommand extends Command {
const accountData = {
Name: user.full_name,
Email: user.email,
Github: ghuser,
GitHub: ghuser,
}
const teamsData = {}

Expand Down
38 changes: 38 additions & 0 deletions tests/command.status.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const test = require('ava')

const callCli = require('./utils/call-cli')
const { withMockApi, getCLIOptions } = require('./utils/mock-api')
const { withSiteBuilder } = require('./utils/site-builder')
const { normalize } = require('./utils/snapshots')

const siteInfo = {
account_slug: 'test-account',
id: 'site_id',
name: 'site-name',
admin_url: 'https://app.netlify.com/sites/test-site/overview',
url: 'https://test-site.netlify.app/',
}

const user = { full_name: 'Test User', email: 'test@netlify.com' }

const accounts = [{ slug: siteInfo.account_slug, name: user.full_name, roles_allowed: [] }]

const routes = [
{ path: 'sites/site_id', response: siteInfo },
{
path: 'accounts',
response: accounts,
},
{ path: 'user', response: user },
]

test('should print status for a linked site', async (t) => {
await withSiteBuilder('linked-site', async (builder) => {
await builder.buildAsync()

await withMockApi(routes, async ({ apiUrl }) => {
const output = await callCli(['status'], getCLIOptions({ builder, apiUrl }))
t.snapshot(normalize(output))
})
})
})
23 changes: 23 additions & 0 deletions tests/snapshots/command.status.test.js.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Snapshot report for `tests/command.status.test.js`

The actual snapshot is saved in `command.status.test.js.snap`.

Generated by [AVA](https://avajs.dev).

## should print status for a linked site

> Snapshot 1
`──────────────────────┐␊
Current Netlify User │␊
──────────────────────┘␊
Name:  Test User␊
Email:  test@netlify.com␊
────────────────────┐␊
Netlify Site Info │␊
────────────────────┘␊
Current site: site-name␊
Admin URL:  https://app.netlify.com/sites/test-site/overview␊
Site URL:  https://test-site.netlify.app/␊
Site Id:  site_id␊
`
Binary file added tests/snapshots/command.status.test.js.snap
Binary file not shown.
2 changes: 2 additions & 0 deletions tests/utils/snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const normalizers = [
// this is specific to npm v6
{ pattern: /@ start.+\/.+netlify-cli-tests-v10.+/, value: 'start' },
{ pattern: /It should be one of.+/gm, value: 'It should be one of: *' },
// ntl status adds the GitHub user if exists - we remove it to be consistent
{ pattern: /\n.+GitHub:.+/, value: '' },
]

const normalize = (inputString) =>
Expand Down

0 comments on commit 6796a5b

Please sign in to comment.