Skip to content

Commit

Permalink
fix: show only generation name in spaces:info output (#3128)
Browse files Browse the repository at this point in the history
* fix: show only generation name in spaces:info output

* test: test fixes for spaces:info and spaces:wait
  • Loading branch information
k80bowman authored Dec 6, 2024
1 parent 16e02a4 commit 48c5b8e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/lib/spaces/spaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function renderInfo(space: SpaceWithOutboundIps, json: boolean) {
State: space.state,
Shield: displayShieldState(space),
'Outbound IPs': displayNat(space.outbound_ips),
Generation: space.generation,
Generation: space.generation.name,
'Created at': space.created_at,
},
['ID', 'Team', 'Region', 'CIDR', 'Data CIDR', 'State', 'Shield', 'Outbound IPs', 'Generation', 'Created at'],
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/src/lib/types/fir.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2407,7 +2407,10 @@ export interface Space {
*
* @example "fir"
*/
generation: string;
generation: {
id: string,
name: string,
}
}
/**
*
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/test/fixtures/spaces/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const spaces: Record<string, SpaceWithOutboundIps> = {
organization: {
name: 'my-org',
},
generation: 'cedar',
generation: {id: '123', name: 'cedar'},
created_at: '2016-01-06T03:23:13Z',
updated_at: '2016-01-06T03:23:13Z',
},
Expand All @@ -43,7 +43,7 @@ export const spaces: Record<string, SpaceWithOutboundIps> = {
organization: {
name: 'my-org',
},
generation: 'cedar',
generation: {id: '123', name: 'cedar'},
created_at: '2016-01-06T03:23:13Z',
updated_at: '2016-01-06T03:23:13Z',
},
Expand All @@ -66,7 +66,7 @@ export const spaces: Record<string, SpaceWithOutboundIps> = {
organization: {
name: 'my-org',
},
generation: 'cedar',
generation: {id: '123', name: 'cedar'},
created_at: '2016-01-06T03:23:13Z',
updated_at: '2016-01-06T03:23:13Z',
},
Expand Down
12 changes: 6 additions & 6 deletions packages/cli/test/unit/commands/spaces/info.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('spaces:info', function () {
Data CIDR: ${space.data_cidr}
State: ${space.state}
Shield: off
Generation: ${space.generation}
Generation: ${space.generation.name}
Created at: ${space.created_at}
`))
})
Expand Down Expand Up @@ -74,7 +74,7 @@ describe('spaces:info', function () {
State: ${space.state}
Shield: off
Outbound IPs: 123.456.789.123
Generation: ${space.generation}
Generation: ${space.generation.name}
Created at: ${space.created_at}
`))
})
Expand All @@ -101,7 +101,7 @@ describe('spaces:info', function () {
State: ${space.state}
Shield: off
Outbound IPs: disabled
Generation: ${space.generation}
Generation: ${space.generation.name}
Created at: ${space.created_at}
`))
})
Expand All @@ -124,7 +124,7 @@ describe('spaces:info', function () {
Data CIDR: ${space.data_cidr}
State: ${space.state}
Shield: off
Generation: ${space.generation}
Generation: ${space.generation.name}
Created at: ${space.created_at}
`))
})
Expand All @@ -147,7 +147,7 @@ describe('spaces:info', function () {
Data CIDR: ${shieldSpace.data_cidr}
State: ${shieldSpace.state}
Shield: on
Generation: ${space.generation}
Generation: ${space.generation.name}
Created at: ${shieldSpace.created_at}
`))
})
Expand All @@ -169,7 +169,7 @@ describe('spaces:info', function () {
Data CIDR: ${space.data_cidr}
State: ${space.state}
Shield: off
Generation: ${space.generation}
Generation: ${space.generation.name}
Created at: ${space.created_at}
`))
})
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/test/unit/commands/spaces/wait.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('spaces:wait', function () {
State: ${allocatedSpace.state}
Shield: off
Outbound IPs: 123.456.789.123
Generation: ${allocatedSpace.generation}
Generation: ${allocatedSpace.generation.name}
Created at: ${allocatedSpace.created_at}
`))
expect(notifySpy.called).to.be.true
Expand Down Expand Up @@ -115,7 +115,7 @@ describe('spaces:wait', function () {
Data CIDR: ${allocatedSpace.data_cidr}
State: ${allocatedSpace.state}
Shield: off
Generation: ${allocatedSpace.generation}
Generation: ${allocatedSpace.generation.name}
Created at: ${allocatedSpace.created_at}
`))
expect(notifySpy.called).to.be.true
Expand Down

0 comments on commit 48c5b8e

Please sign in to comment.