Skip to content

Commit

Permalink
chore: increase postage batch size
Browse files Browse the repository at this point in the history
  • Loading branch information
AuHau committed May 27, 2021
1 parent 14284f9 commit 4dedb8e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 9 additions & 7 deletions test/integration/modules/debug/settlements.spec.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import * as settlements from '../../../../src/modules/debug/settlements'
import { beeDebugUrl } from '../../../utils'
import { beeDebugUrl, commonMatchers } from '../../../utils'

commonMatchers()

describe('settlements', () => {
test('all settlements', async () => {
const response = await settlements.getAllSettlements(beeDebugUrl())

expect(typeof response.totalReceived).toBe('bigint')
expect(typeof response.totalSent).toBe('bigint')
expect(response.totalReceived).toBeType('bigint')
expect(response.totalSent).toBeType('bigint')
expect(Array.isArray(response.settlements)).toBeTruthy()

if (response.settlements.length > 0) {
expect(response.settlements).toEqual(
expect.arrayContaining([
expect.objectContaining({
peer: expect.any(String),
received: expect.any(Number),
sent: expect.any(Number),
received: expect.any(BigInt),
sent: expect.any(BigInt),
}),
]),
)
Expand All @@ -25,8 +27,8 @@ describe('settlements', () => {
const peerSettlementResponse = await settlements.getSettlements(beeDebugUrl(), peerSettlement.peer)

expect(peerSettlementResponse.peer).toEqual(peerSettlement.peer)
expect(typeof peerSettlementResponse.received).toBe('bigint')
expect(typeof peerSettlementResponse.sent).toBe('bigint')
expect(peerSettlementResponse.received).toBeType('bigint')
expect(peerSettlementResponse.sent).toBeType('bigint')
}
})
})
4 changes: 2 additions & 2 deletions test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ const batchId: Record<string, Address> = {}
export async function getPostageBatch(url = beeUrl()): Promise<Address> {
if (!batchId[url]) {
try {
batchId[url] = await createPostageBatch(url, BigInt('10'), 253)
batchId[url] = await createPostageBatch(url, BigInt('0'), 253)
} catch (e) {
await sleep(500)

const batches = await getAllPostageBatches(url)

if (!batches.length) {
batchId[url] = await createPostageBatch(url, BigInt('10'), 253)
batchId[url] = await createPostageBatch(url, BigInt('0'), 253)
} else {
batchId[url] = batches[0].batchID
}
Expand Down

0 comments on commit 4dedb8e

Please sign in to comment.