Skip to content

Commit 837c0bd

Browse files
authored
feat: add isWarmingUp flag to getStatus (#1054)
* feat: add isWarmingUp flag to getStatus * chore: fix lint issues
1 parent d1ed701 commit 837c0bd

9 files changed

Lines changed: 21 additions & 8 deletions

File tree

src/manifest/manifest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export class Fork {
3333
b.prefix = b.prefix.slice(commonPart.length)
3434
b.node.parent = a.node
3535
a.node.forks.set(remainingB[0], b)
36+
3637
return a
3738
}
3839

@@ -42,6 +43,7 @@ export class Fork {
4243
a.prefix = a.prefix.slice(commonPart.length)
4344
a.node.parent = b.node
4445
b.node.forks.set(remainingA[0], a)
46+
4547
return b
4648
}
4749

src/modules/debug/status.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export async function getDebugStatus(requestOptions: BeeRequestOptions): Promise
3737
isReachable: Types.asBoolean(body.isReachable, { name: 'isReachable' }),
3838
lastSyncedBlock: Types.asNumber(body.lastSyncedBlock, { name: 'lastSyncedBlock' }),
3939
committedDepth: Types.asNumber(body.committedDepth, { name: 'committedDepth' }),
40+
isWarmingUp: Types.asBoolean(body.isWarmingUp, { name: 'isWarmingUp' }),
4041
}
4142
}
4243

src/modules/status.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export async function isGateway(requestOptions: BeeRequestOptions): Promise<bool
1919
url: '/gateway',
2020
})
2121
const data = Types.asObject(response.data)
22+
2223
return Types.asBoolean(data.gateway)
2324
} catch (error) {
2425
return false

src/types/debug.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export interface DebugStatus {
105105
isReachable: boolean
106106
lastSyncedBlock: number
107107
committedDepth: number
108+
isWarmingUp: boolean
108109
}
109110

110111
export interface Health {

test/integration/feed.ux.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ test('Feed read/write as payload', async () => {
1010
writer.uploadPayload(batch(), 'Feed payload', { deferred: false })
1111

1212
await System.waitFor(
13-
() => bee.isFeedRetrievable(writer.owner, writer.topic, FeedIndex.fromBigInt(0n)),
13+
async () => bee.isFeedRetrievable(writer.owner, writer.topic, FeedIndex.fromBigInt(0n)),
1414
Dates.seconds(1),
1515
30,
1616
)
@@ -32,7 +32,7 @@ test('Feed read/write as reference', async () => {
3232
await writer.uploadReference(batch(), uploadResult.reference)
3333

3434
await System.waitFor(
35-
() => bee.isFeedRetrievable(writer.owner, writer.topic, FeedIndex.fromBigInt(0n)),
35+
async () => bee.isFeedRetrievable(writer.owner, writer.topic, FeedIndex.fromBigInt(0n)),
3636
Dates.seconds(1),
3737
30,
3838
)
@@ -52,7 +52,7 @@ test('Feed read/write 40 bytes payload', async () => {
5252
writer.uploadPayload(batch(), 'This string is exactly 40 bytes in utf-8', { deferred: false })
5353

5454
await System.waitFor(
55-
() => bee.isFeedRetrievable(writer.owner, writer.topic, FeedIndex.fromBigInt(0n)),
55+
async () => bee.isFeedRetrievable(writer.owner, writer.topic, FeedIndex.fromBigInt(0n)),
5656
Dates.seconds(1),
5757
30,
5858
)
@@ -70,7 +70,7 @@ test('Feed read/write as payload when data does not fit into one chunk', async (
7070
writer.uploadPayload(batch(), text, { deferred: false })
7171

7272
await System.waitFor(
73-
() => bee.isFeedRetrievable(writer.owner, writer.topic, FeedIndex.fromBigInt(0n)),
73+
async () => bee.isFeedRetrievable(writer.owner, writer.topic, FeedIndex.fromBigInt(0n)),
7474
Dates.seconds(1),
7575
30,
7676
)

test/integration/stamp.ux.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ test('bee.getSizeExtensionCost', async () => {
4545
)
4646
expect(cost.toSignificantDigits(3)).toBe('72.011')
4747

48-
await expect(() =>
48+
await expect(async () =>
4949
bee.getSizeExtensionCost(
5050
'f8b2ad296d64824a8fe51a33ff15fe8668df13a20ad3d4eea4bb97ca600029aa',
5151
Size.fromGigabytes(1),
@@ -72,7 +72,7 @@ test('bee.buyStorage with extensions', async () => {
7272
await bee.extendStorageDuration(batchId, Duration.fromDays(1))
7373
await bee.extendStorageSize(batchId, Size.fromGigabytes(8))
7474
await bee.extendStorageSize(batchId, Size.fromGigabytes(24))
75-
await expect(() => bee.extendStorageSize(batchId, Size.fromGigabytes(1))).rejects.toThrow(
75+
await expect(async () => bee.extendStorageSize(batchId, Size.fromGigabytes(1))).rejects.toThrow(
7676
'New depth has to be greater than the original depth',
7777
)
7878
})

test/integration/status.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ test('GET wallet', async () => {
7878
test('GET status', async () => {
7979
const status = await bee.getStatus()
8080
expect(status).toBeTruthy()
81+
expect(status.beeMode).toBe('full')
82+
expect(status.isWarmingUp).toBe(false)
8183
})
8284

8385
test('GET topology', async () => {

test/integration/withdraw.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ test('withdraw to external wallet', async () => {
1010
await System.waitFor(
1111
async () => {
1212
const pendingTransactions = await bee.getAllPendingTransactions()
13+
1314
return pendingTransactions.length === 0
1415
},
1516
Dates.seconds(1),
@@ -20,6 +21,7 @@ test('withdraw to external wallet', async () => {
2021
await System.waitFor(
2122
async () => {
2223
const pendingTransactions = await bee.getAllPendingTransactions()
24+
2325
return pendingTransactions.length === 0
2426
},
2527
Dates.seconds(1),

test/unit/ws-undefined.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ test('WebSocket undefined headers', async () => {
77
})
88

99
const subscription = bee.gsocSubscribe(NULL_OWNER, NULL_IDENTIFIER, {
10-
onMessage: () => {},
11-
onError: () => {},
10+
onMessage: () => {
11+
void 0
12+
},
13+
onError: () => {
14+
void 0
15+
},
1216
})
1317

1418
subscription.cancel()

0 commit comments

Comments
 (0)