Skip to content

Commit 0b2d398

Browse files
Lint fixes for type safety.
1 parent b257dc5 commit 0b2d398

File tree

4 files changed

+42
-39
lines changed

4 files changed

+42
-39
lines changed

src/types/broker.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
export interface EventBrokerCreateDetail {
2-
completedTime: string
3-
createdBy: string
4-
createdTime: string
2+
completedTime?: string
3+
createdBy?: string
4+
createdTime?: string
55
error?: {
66
errorId: string
77
message: string
88
}
99
id: string
10-
operationType: string
11-
progressLogs: {
10+
operationType?: string
11+
progressLogs?: {
1212
message: string
1313
step: string
1414
timestamp: string
1515
}[]
16-
resourceId: string
17-
resourceType: string
18-
status: string
19-
type: string
16+
resourceId?: string
17+
resourceType?: string
18+
status?: string
19+
type?: string
2020
}
2121

2222
export interface EventBrokerCreateApiResponse {
@@ -47,18 +47,18 @@ export interface EventBrokerListApiResponse {
4747
}
4848

4949
export interface EventBrokerServiceDetail {
50-
adminState: string
51-
createdTime: string
52-
creationState: string
53-
datacenterId: string
54-
environmentId: string
55-
eventBrokerServiceVersion: string
50+
adminState?: string
51+
createdTime?: string
52+
creationState?: string
53+
datacenterId?: string
54+
environmentId?: string
55+
eventBrokerServiceVersion?: string
5656
id: string
57-
infrastructureId: string
58-
locked: boolean
59-
msgVpnName: string
57+
infrastructureId?: string
58+
locked?: boolean
59+
msgVpnName?: string
6060
name: string
61-
ownedBy: string
62-
serviceClassId: string
63-
type: string
61+
ownedBy?: string
62+
serviceClassId?: string
63+
type?: string
6464
}

src/types/environment.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
// It is used to define the structure of the environment data returned by the API.
33
// The interfaces are used to ensure that the data returned by the API matches the expected structure.
44
export interface Environment {
5-
bgColor: string
6-
createdBy: string
7-
createdTime: string
8-
description: string
9-
fgColor: string
10-
icon: string
11-
id: string
12-
isDefault: boolean
13-
isProduction: boolean
5+
bgColor?: string
6+
createdBy?: string
7+
createdTime?: string
8+
description?: string
9+
fgColor?: string
10+
icon?: string
11+
id?: string
12+
isDefault?: boolean
13+
isProduction?: boolean
1414
name: string
15-
organization: {
15+
organization?: {
1616
id: string
1717
internal: boolean
1818
name: string
1919
organizationType: string
2020
}
21-
type: string
22-
updatedBy: string
23-
updatedTime: string
21+
type?: string
22+
updatedBy?: string
23+
updatedTime?: string
2424
}
2525
// Example of an Environment object
2626
// {

test/commands/missionctrl/broker/list.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { expect } from 'chai'
33
import * as sinon from 'sinon'
44
import { table } from 'table'
55

6+
import { EventBrokerServiceDetail } from '../../../../src/types/broker.js'
67
import { ScConnection } from '../../../../src/util/sc-connection.js'
78

89
function anBroker(brokerName: string, brokerId: string) {
@@ -11,6 +12,7 @@ function anBroker(brokerName: string, brokerId: string) {
1112
createdBy: 'test',
1213
createdTime: '2024-09-05T19:54:42.766',
1314
id: brokerId,
15+
name: brokerName,
1416
operationType: '',
1517
resourceId: '',
1618
resourceType: '',
@@ -32,7 +34,7 @@ describe('missionctrl:broker:list', () => {
3234

3335
it('runs missionctrl:broker:list cmd', async () => {
3436
// Arrange
35-
const envs = {
37+
const brokers = {
3638
data: [anBroker('Broker1', 'BrokerId1'), anBroker('Broker1', 'BrokerId1'),
3739
anBroker('Broker3', 'BrokerId3')],
3840
meta: {
@@ -45,12 +47,12 @@ describe('missionctrl:broker:list', () => {
4547
}
4648
}
4749
}
48-
scConnStub.returns(Promise.resolve(envs))
50+
scConnStub.returns(Promise.resolve(brokers))
4951

5052
// Expected
5153
const brokerArray = [
5254
['Name', 'Id', 'Type', 'Version', 'Owned By', 'Datacenter Id', 'Service Class Id'],
53-
...envs.data.map((item: any) => [
55+
...brokers.data.map((item: EventBrokerServiceDetail) => [
5456
item.name,
5557
item.id,
5658
item.type,

test/commands/platform/env/list.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { expect } from 'chai'
33
import * as sinon from 'sinon'
44
import { table } from 'table'
55

6+
import { Environment } from '../../../../src/types/environment'
67
import { ScConnection } from '../../../../src/util/sc-connection'
78

89
function anEnv(name: string, isDefault: boolean, isProd: boolean) {
@@ -49,7 +50,7 @@ describe('platform:env:list', () => {
4950
// Expected
5051
const envArray = [
5152
['Name', 'Id', 'Is Default', 'Is Production', 'Description'],
52-
...envs.data.map((item: any) => [
53+
...envs.data.map((item: Environment) => [
5354
item.name,
5455
item.id,
5556
item.isDefault,
@@ -86,7 +87,7 @@ describe('platform:env:list', () => {
8687
// Expected
8788
const envArray = [
8889
['Name', 'Id', 'Is Default', 'Is Production', 'Description'],
89-
...envs.data.map((item: any) => [
90+
...envs.data.map((item: Environment) => [
9091
item.name,
9192
item.id,
9293
item.isDefault,

0 commit comments

Comments
 (0)