@ethersphere/bee-js 1.2.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +135 -2
- package/README.md +3 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.LICENSE.txt +51 -0
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.LICENSE.txt +42 -0
- package/dist/index.min.js.map +1 -1
- package/dist/src/bee-debug.d.ts +75 -38
- package/dist/src/bee.d.ts +88 -82
- package/dist/src/chunk/soc.d.ts +6 -6
- package/dist/src/feed/index.d.ts +7 -7
- package/dist/src/feed/json.d.ts +2 -2
- package/dist/src/modules/bytes.d.ts +8 -11
- package/dist/src/modules/bzz.d.ts +9 -14
- package/dist/src/modules/chunk.d.ts +7 -11
- package/dist/src/modules/debug/balance.d.ts +9 -9
- package/dist/src/modules/debug/chequebook.d.ts +17 -18
- package/dist/src/modules/debug/chunk.d.ts +5 -5
- package/dist/src/modules/debug/connectivity.d.ts +7 -7
- package/dist/src/modules/debug/settlements.d.ts +5 -5
- package/dist/src/modules/debug/stamps.d.ts +7 -5
- package/dist/src/modules/debug/states.d.ts +5 -5
- package/dist/src/modules/debug/status.d.ts +5 -4
- package/dist/src/modules/debug/tag.d.ts +3 -3
- package/dist/src/modules/debug/transactions.d.ts +9 -9
- package/dist/src/modules/feed.d.ts +5 -5
- package/dist/src/modules/pinning.d.ts +9 -9
- package/dist/src/modules/pss.d.ts +4 -3
- package/dist/src/modules/soc.d.ts +3 -3
- package/dist/src/modules/status.d.ts +3 -2
- package/dist/src/modules/stewardship.d.ts +4 -4
- package/dist/src/modules/tag.d.ts +6 -6
- package/dist/src/types/debug.d.ts +4 -2
- package/dist/src/types/index.d.ts +71 -19
- package/dist/src/utils/bytes.d.ts +1 -1
- package/dist/src/utils/data.browser.d.ts +3 -1
- package/dist/src/utils/data.d.ts +7 -4
- package/dist/src/utils/expose.d.ts +6 -9
- package/dist/src/utils/headers.d.ts +3 -3
- package/dist/src/utils/http.d.ts +25 -0
- package/dist/src/utils/merge.d.ts +8 -0
- package/dist/src/utils/pss.d.ts +9 -0
- package/dist/src/utils/stream.d.ts +37 -0
- package/dist/src/utils/type.d.ts +19 -9
- package/package.json +15 -8
- package/.babelrc.js +0 -33
- package/.depcheckrc.json +0 -27
- package/.editorconfig +0 -6
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -108
- package/.gitattributes +0 -1
- package/.github/config.yaml +0 -23
- package/.github/workflows/check.yaml +0 -57
- package/.github/workflows/publish_npmjs.yaml +0 -20
- package/.github/workflows/release_github.yaml +0 -20
- package/.github/workflows/tests.yaml +0 -128
- package/.huskyrc +0 -5
- package/.prettierrc +0 -13
- package/.vscode/launch.json +0 -49
- package/.vscode/settings.json +0 -39
- package/CODEOWNERS +0 -1
- package/CODE_OF_CONDUCT.md +0 -76
- package/commitlint.config.js +0 -3
- package/dist/src/modules/stamps.d.ts +0 -4
- package/dist/src/utils/hooks.d.ts +0 -31
- package/dist/src/utils/safe-axios.d.ts +0 -8
- package/jest-puppeteer.config.js +0 -5
- package/jest.config.ts +0 -170
- package/src/bee-debug.ts +0 -440
- package/src/bee.ts +0 -941
- package/src/chunk/bmt.ts +0 -55
- package/src/chunk/cac.ts +0 -79
- package/src/chunk/serialize.ts +0 -16
- package/src/chunk/signer.ts +0 -141
- package/src/chunk/soc.ts +0 -190
- package/src/chunk/span.ts +0 -33
- package/src/feed/index.ts +0 -221
- package/src/feed/json.ts +0 -32
- package/src/feed/topic.ts +0 -23
- package/src/feed/type.ts +0 -12
- package/src/index.ts +0 -24
- package/src/modules/bytes.ts +0 -75
- package/src/modules/bzz.ts +0 -184
- package/src/modules/chunk.ts +0 -75
- package/src/modules/debug/balance.ts +0 -63
- package/src/modules/debug/chequebook.ts +0 -174
- package/src/modules/debug/chunk.ts +0 -39
- package/src/modules/debug/connectivity.ts +0 -61
- package/src/modules/debug/settlements.ts +0 -33
- package/src/modules/debug/stamps.ts +0 -69
- package/src/modules/debug/states.ts +0 -35
- package/src/modules/debug/status.ts +0 -34
- package/src/modules/debug/tag.ts +0 -19
- package/src/modules/debug/transactions.ts +0 -79
- package/src/modules/feed.ts +0 -92
- package/src/modules/pinning.ts +0 -74
- package/src/modules/pss.ts +0 -48
- package/src/modules/soc.ts +0 -41
- package/src/modules/stamps.ts +0 -59
- package/src/modules/status.ts +0 -13
- package/src/modules/stewardship.ts +0 -21
- package/src/modules/tag.ts +0 -83
- package/src/types/axios/index.d.ts +0 -18
- package/src/types/debug.ts +0 -204
- package/src/types/index.ts +0 -497
- package/src/types/tar-js.d.ts +0 -1
- package/src/types/webpack-bundle-analyzer/index.d.ts +0 -13
- package/src/utils/bytes.ts +0 -144
- package/src/utils/collection.ts +0 -151
- package/src/utils/data.browser.ts +0 -24
- package/src/utils/data.ts +0 -35
- package/src/utils/error.ts +0 -23
- package/src/utils/eth.ts +0 -229
- package/src/utils/expose.ts +0 -10
- package/src/utils/file.ts +0 -40
- package/src/utils/hash.ts +0 -16
- package/src/utils/headers.ts +0 -63
- package/src/utils/hex.ts +0 -186
- package/src/utils/hooks.ts +0 -89
- package/src/utils/safe-axios.ts +0 -98
- package/src/utils/tar.ts +0 -30
- package/src/utils/type.ts +0 -302
- package/src/utils/uint64.ts +0 -31
- package/src/utils/url.ts +0 -52
- package/test/bee.sh +0 -187
- package/test/data/1.txt +0 -1
- package/test/data/2.txt +0 -0
- package/test/data/empty +0 -0
- package/test/data/sub/3.txt +0 -1
- package/test/data/sub//303/251 +0 -0
- package/test/data/sub//360/237/230/216 +0 -0
- package/test/integration/bee-class.browser.spec.ts +0 -215
- package/test/integration/bee-class.spec.ts +0 -595
- package/test/integration/bee-debug-class.spec.ts +0 -85
- package/test/integration/chunk/bmt.spec.ts +0 -33
- package/test/integration/chunk/cac.spec.ts +0 -27
- package/test/integration/chunk/soc.spec.ts +0 -38
- package/test/integration/feed/index.spec.ts +0 -84
- package/test/integration/modules/bytes.spec.ts +0 -23
- package/test/integration/modules/bzz.spec.ts +0 -270
- package/test/integration/modules/chunk.spec.ts +0 -29
- package/test/integration/modules/debug/balance.spec.ts +0 -70
- package/test/integration/modules/debug/chequebook.spec.ts +0 -64
- package/test/integration/modules/debug/connectivity.spec.ts +0 -69
- package/test/integration/modules/debug/settlements.spec.ts +0 -34
- package/test/integration/modules/debug/states.spec.ts +0 -34
- package/test/integration/modules/debug/status.spec.ts +0 -65
- package/test/integration/modules/debug/tag.spec.ts +0 -27
- package/test/integration/modules/feed.spec.ts +0 -61
- package/test/integration/modules/pinning.spec.ts +0 -155
- package/test/integration/modules/pss.spec.ts +0 -92
- package/test/integration/modules/status.spec.ts +0 -10
- package/test/integration/modules/stewardship.spec.ts +0 -32
- package/test/integration/modules/tag.spec.ts +0 -51
- package/test/test-type-sequencer.js +0 -36
- package/test/testpage/testpage.html +0 -20
- package/test/unit/assertions.ts +0 -376
- package/test/unit/bee-class.spec.ts +0 -685
- package/test/unit/bee-debug-class.spec.ts +0 -365
- package/test/unit/chunk/bmt.spec.ts +0 -16
- package/test/unit/chunk/cac.spec.ts +0 -29
- package/test/unit/chunk/serialize.spec.ts +0 -24
- package/test/unit/chunk/signer.spec.ts +0 -140
- package/test/unit/chunk/soc.spec.ts +0 -25
- package/test/unit/chunk/span.spec.ts +0 -38
- package/test/unit/feed/json.spec.ts +0 -73
- package/test/unit/nock.ts +0 -134
- package/test/unit/utils/bytes.spec.ts +0 -32
- package/test/unit/utils/collection.spec.ts +0 -22
- package/test/unit/utils/eth.spec.ts +0 -224
- package/test/unit/utils/hex.spec.ts +0 -115
- package/test/unit/utils/hooks.spec.ts +0 -179
- package/test/unit/utils/safe-axios.spec.ts +0 -20
- package/test/unit/utils/type.spec.ts +0 -32
- package/test/unit/utils/uint64.spec.ts +0 -102
- package/test/utils.ts +0 -292
- package/tsconfig.json +0 -18
- package/tsconfig.test.json +0 -11
- package/typedoc.json +0 -7
- package/webpack.config.ts +0 -141
|
@@ -1,685 +0,0 @@
|
|
|
1
|
-
import { assertAllIsDone, createPostageBatchMock, downloadDataMock, fetchFeedUpdateMock, MOCK_SERVER_URL } from './nock'
|
|
2
|
-
import {
|
|
3
|
-
BatchId,
|
|
4
|
-
Bee,
|
|
5
|
-
BeeArgumentError,
|
|
6
|
-
CollectionUploadOptions,
|
|
7
|
-
PssMessageHandler,
|
|
8
|
-
ReferenceResponse,
|
|
9
|
-
UploadOptions,
|
|
10
|
-
} from '../../src'
|
|
11
|
-
import { testBatchId, testIdentity, testJsonHash, testJsonPayload, testJsonStringPayload } from '../utils'
|
|
12
|
-
import { makeTopicFromString } from '../../src/feed/topic'
|
|
13
|
-
import {
|
|
14
|
-
testAddressPrefixAssertions,
|
|
15
|
-
testBatchIdAssertion,
|
|
16
|
-
testCollectionUploadOptionsAssertions,
|
|
17
|
-
testDataAssertions,
|
|
18
|
-
testFileDataAssertions,
|
|
19
|
-
testFileUploadOptionsAssertions,
|
|
20
|
-
testPssMessageHandlerAssertions,
|
|
21
|
-
testPublicKeyAssertions,
|
|
22
|
-
testReferenceAssertions,
|
|
23
|
-
testTopicAssertions,
|
|
24
|
-
testUploadOptionsAssertions,
|
|
25
|
-
testFeedTypeAssertions,
|
|
26
|
-
testFeedTopicAssertions,
|
|
27
|
-
testEthAddressAssertions,
|
|
28
|
-
testMakeSignerAssertions,
|
|
29
|
-
} from './assertions'
|
|
30
|
-
import { FeedType } from '../../src/feed/type'
|
|
31
|
-
|
|
32
|
-
const TOPIC = 'some=very%nice#topic'
|
|
33
|
-
const HASHED_TOPIC = makeTopicFromString(TOPIC)
|
|
34
|
-
|
|
35
|
-
describe('Bee class', () => {
|
|
36
|
-
function testUrl(url: unknown): void {
|
|
37
|
-
it(`should not accept invalid url '${url}'`, () => {
|
|
38
|
-
try {
|
|
39
|
-
new Bee(url as string)
|
|
40
|
-
fail('Bee constructor should have thrown error.')
|
|
41
|
-
} catch (e) {
|
|
42
|
-
if (e instanceof BeeArgumentError) {
|
|
43
|
-
expect(e.value).toEqual(url)
|
|
44
|
-
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
throw e
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
testUrl('')
|
|
54
|
-
testUrl(null)
|
|
55
|
-
testUrl(undefined)
|
|
56
|
-
testUrl(1)
|
|
57
|
-
testUrl('some-invalid-url')
|
|
58
|
-
testUrl('invalid:protocol')
|
|
59
|
-
// eslint-disable-next-line no-script-url
|
|
60
|
-
testUrl('javascript:console.log()')
|
|
61
|
-
testUrl('ws://localhost:1633')
|
|
62
|
-
|
|
63
|
-
describe('uploadData', () => {
|
|
64
|
-
testBatchIdAssertion(async (input: unknown) => {
|
|
65
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
66
|
-
|
|
67
|
-
return bee.uploadData(input as BatchId, '')
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
testDataAssertions(async (input: unknown) => {
|
|
71
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
72
|
-
|
|
73
|
-
return bee.uploadData(testBatchId, input as string)
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
testUploadOptionsAssertions(async (input: unknown) => {
|
|
77
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
78
|
-
|
|
79
|
-
return bee.uploadData(testBatchId, '', input as UploadOptions)
|
|
80
|
-
})
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
describe('downloadData', () => {
|
|
84
|
-
testReferenceAssertions(async (input: unknown) => {
|
|
85
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
86
|
-
|
|
87
|
-
return bee.downloadData(input as string)
|
|
88
|
-
})
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
describe('downloadReadableData', () => {
|
|
92
|
-
testReferenceAssertions(async (input: unknown) => {
|
|
93
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
94
|
-
|
|
95
|
-
return bee.downloadReadableData(input as string)
|
|
96
|
-
})
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
describe('uploadFile', () => {
|
|
100
|
-
testBatchIdAssertion(async (input: unknown) => {
|
|
101
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
102
|
-
|
|
103
|
-
return bee.uploadFile(input as BatchId, '')
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
testFileDataAssertions(async (input: unknown) => {
|
|
107
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
108
|
-
|
|
109
|
-
return bee.uploadFile(testBatchId, input as string)
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
testUploadOptionsAssertions(async (input: unknown) => {
|
|
113
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
114
|
-
|
|
115
|
-
return bee.uploadFile(testBatchId, '', undefined, input as UploadOptions)
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
testFileUploadOptionsAssertions(async (input: unknown) => {
|
|
119
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
120
|
-
|
|
121
|
-
return bee.uploadFile(testBatchId, '', undefined, input as UploadOptions)
|
|
122
|
-
})
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
describe('downloadFile', () => {
|
|
126
|
-
testReferenceAssertions(async (input: unknown) => {
|
|
127
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
128
|
-
|
|
129
|
-
return bee.downloadFile(input as string)
|
|
130
|
-
})
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
describe('downloadReadableFile', () => {
|
|
134
|
-
testReferenceAssertions(async (input: unknown) => {
|
|
135
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
136
|
-
|
|
137
|
-
return bee.downloadReadableFile(input as string)
|
|
138
|
-
})
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
describe('uploadFiles', () => {
|
|
142
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
143
|
-
const files = [{ name: 'some name', arrayBuffer() {} }] as File[]
|
|
144
|
-
|
|
145
|
-
testBatchIdAssertion(async (input: unknown) => {
|
|
146
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
147
|
-
|
|
148
|
-
return bee.uploadFiles(input as BatchId, files)
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
testUploadOptionsAssertions(async (input: unknown) => {
|
|
152
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
153
|
-
|
|
154
|
-
return bee.uploadFiles(testBatchId, files, input as UploadOptions)
|
|
155
|
-
})
|
|
156
|
-
|
|
157
|
-
testCollectionUploadOptionsAssertions(async (input: unknown) => {
|
|
158
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
159
|
-
|
|
160
|
-
return bee.uploadFiles(testBatchId, files, input as UploadOptions)
|
|
161
|
-
})
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
describe('uploadFilesFromDirectory', () => {
|
|
165
|
-
testBatchIdAssertion(async (input: unknown) => {
|
|
166
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
167
|
-
|
|
168
|
-
return bee.uploadFilesFromDirectory(input as BatchId, 'some path')
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
testUploadOptionsAssertions(async (input: unknown) => {
|
|
172
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
173
|
-
|
|
174
|
-
return bee.uploadFilesFromDirectory(testBatchId, 'some path', input as CollectionUploadOptions)
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
testCollectionUploadOptionsAssertions(async (input: unknown) => {
|
|
178
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
179
|
-
|
|
180
|
-
return bee.uploadFilesFromDirectory(testBatchId, 'some path', input as CollectionUploadOptions)
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
it('should throw exception for bad Dir', async () => {
|
|
184
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
185
|
-
|
|
186
|
-
await expect(bee.uploadFilesFromDirectory(testBatchId, '')).rejects.toThrow(TypeError)
|
|
187
|
-
// @ts-ignore: Type testing
|
|
188
|
-
await expect(bee.uploadFilesFromDirectory(testBatchId, true)).rejects.toThrow(TypeError)
|
|
189
|
-
// @ts-ignore: Type testing
|
|
190
|
-
await expect(bee.uploadFilesFromDirectory(testBatchId, 1)).rejects.toThrow(TypeError)
|
|
191
|
-
// @ts-ignore: Type testing
|
|
192
|
-
await expect(bee.uploadFilesFromDirectory(testBatchId, [])).rejects.toThrow(TypeError)
|
|
193
|
-
// @ts-ignore: Type testing
|
|
194
|
-
await expect(bee.uploadFilesFromDirectory(testBatchId, {})).rejects.toThrow(TypeError)
|
|
195
|
-
// @ts-ignore: Type testing
|
|
196
|
-
await expect(bee.uploadFilesFromDirectory(testBatchId, null)).rejects.toThrow(TypeError)
|
|
197
|
-
// @ts-ignore: Type testing
|
|
198
|
-
await expect(bee.uploadFilesFromDirectory(testBatchId, undefined)).rejects.toThrow(TypeError)
|
|
199
|
-
})
|
|
200
|
-
})
|
|
201
|
-
|
|
202
|
-
describe('retrieveTag', () => {
|
|
203
|
-
it('should throw exception for bad Tag', async () => {
|
|
204
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
205
|
-
|
|
206
|
-
// @ts-ignore: Type testing
|
|
207
|
-
await expect(bee.retrieveTag('')).rejects.toThrow(TypeError)
|
|
208
|
-
// @ts-ignore: Type testing
|
|
209
|
-
await expect(bee.retrieveTag(true)).rejects.toThrow(TypeError)
|
|
210
|
-
// @ts-ignore: Type testing
|
|
211
|
-
await expect(bee.retrieveTag([])).rejects.toThrow(TypeError)
|
|
212
|
-
// @ts-ignore: Type testing
|
|
213
|
-
await expect(bee.retrieveTag({})).rejects.toThrow(TypeError)
|
|
214
|
-
// @ts-ignore: Type testing
|
|
215
|
-
await expect(bee.retrieveTag(null)).rejects.toThrow(TypeError)
|
|
216
|
-
// @ts-ignore: Type testing
|
|
217
|
-
await expect(bee.retrieveTag(undefined)).rejects.toThrow(TypeError)
|
|
218
|
-
|
|
219
|
-
// @ts-ignore: Type testing
|
|
220
|
-
await expect(bee.retrieveTag({ total: true })).rejects.toThrow(TypeError)
|
|
221
|
-
// @ts-ignore: Type testing
|
|
222
|
-
await expect(bee.retrieveTag({ total: 'asdf' })).rejects.toThrow(TypeError)
|
|
223
|
-
// @ts-ignore: Type testing
|
|
224
|
-
await expect(bee.retrieveTag({ total: null })).rejects.toThrow(TypeError)
|
|
225
|
-
|
|
226
|
-
await expect(bee.retrieveTag(-1)).rejects.toThrow(BeeArgumentError)
|
|
227
|
-
})
|
|
228
|
-
})
|
|
229
|
-
|
|
230
|
-
describe('deleteTag', () => {
|
|
231
|
-
it('should throw exception for bad Tag', async () => {
|
|
232
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
233
|
-
|
|
234
|
-
// @ts-ignore: Type testing
|
|
235
|
-
await expect(bee.deleteTag('')).rejects.toThrow(TypeError)
|
|
236
|
-
// @ts-ignore: Type testing
|
|
237
|
-
await expect(bee.deleteTag(true)).rejects.toThrow(TypeError)
|
|
238
|
-
// @ts-ignore: Type testing
|
|
239
|
-
await expect(bee.deleteTag([])).rejects.toThrow(TypeError)
|
|
240
|
-
// @ts-ignore: Type testing
|
|
241
|
-
await expect(bee.deleteTag({})).rejects.toThrow(TypeError)
|
|
242
|
-
// @ts-ignore: Type testing
|
|
243
|
-
await expect(bee.deleteTag(null)).rejects.toThrow(TypeError)
|
|
244
|
-
// @ts-ignore: Type testing
|
|
245
|
-
await expect(bee.deleteTag(undefined)).rejects.toThrow(TypeError)
|
|
246
|
-
|
|
247
|
-
// @ts-ignore: Type testing
|
|
248
|
-
await expect(bee.deleteTag({ total: true })).rejects.toThrow(TypeError)
|
|
249
|
-
// @ts-ignore: Type testing
|
|
250
|
-
await expect(bee.deleteTag({ total: 'asdf' })).rejects.toThrow(TypeError)
|
|
251
|
-
// @ts-ignore: Type testing
|
|
252
|
-
await expect(bee.deleteTag({ total: null })).rejects.toThrow(TypeError)
|
|
253
|
-
|
|
254
|
-
await expect(bee.deleteTag(-1)).rejects.toThrow(BeeArgumentError)
|
|
255
|
-
})
|
|
256
|
-
})
|
|
257
|
-
|
|
258
|
-
describe('getAllTags', () => {
|
|
259
|
-
it('should throw exception for bad options', async () => {
|
|
260
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
261
|
-
|
|
262
|
-
// @ts-ignore: Type testing
|
|
263
|
-
await expect(bee.getAllTags('')).rejects.toThrow(TypeError)
|
|
264
|
-
// @ts-ignore: Type testing
|
|
265
|
-
await expect(bee.getAllTags(true)).rejects.toThrow(TypeError)
|
|
266
|
-
// @ts-ignore: Type testing
|
|
267
|
-
await expect(bee.getAllTags(-1)).rejects.toThrow(TypeError)
|
|
268
|
-
// @ts-ignore: Type testing
|
|
269
|
-
await expect(bee.getAllTags([])).rejects.toThrow(TypeError)
|
|
270
|
-
// @ts-ignore: Type testing
|
|
271
|
-
await expect(bee.getAllTags(null)).rejects.toThrow(TypeError)
|
|
272
|
-
})
|
|
273
|
-
|
|
274
|
-
it('should throw exception for bad limit', async () => {
|
|
275
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
276
|
-
|
|
277
|
-
// @ts-ignore: Type testing
|
|
278
|
-
await expect(bee.getAllTags({ limit: '' })).rejects.toThrow(TypeError)
|
|
279
|
-
// @ts-ignore: Type testing
|
|
280
|
-
await expect(bee.getAllTags({ limit: true })).rejects.toThrow(TypeError)
|
|
281
|
-
// @ts-ignore: Type testing
|
|
282
|
-
await expect(bee.getAllTags({ limit: [] })).rejects.toThrow(TypeError)
|
|
283
|
-
// @ts-ignore: Type testing
|
|
284
|
-
await expect(bee.getAllTags({ limit: {} })).rejects.toThrow(TypeError)
|
|
285
|
-
// @ts-ignore: Type testing
|
|
286
|
-
await expect(bee.getAllTags({ limit: null })).rejects.toThrow(TypeError)
|
|
287
|
-
|
|
288
|
-
await expect(bee.getAllTags({ limit: -1 })).rejects.toThrow(BeeArgumentError)
|
|
289
|
-
await expect(bee.getAllTags({ limit: Number.MAX_VALUE })).rejects.toThrow(BeeArgumentError)
|
|
290
|
-
})
|
|
291
|
-
|
|
292
|
-
it('should throw exception for bad offset', async () => {
|
|
293
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
294
|
-
|
|
295
|
-
// @ts-ignore: Type testing
|
|
296
|
-
await expect(bee.getAllTags({ offset: '' })).rejects.toThrow(TypeError)
|
|
297
|
-
// @ts-ignore: Type testing
|
|
298
|
-
await expect(bee.getAllTags({ offset: true })).rejects.toThrow(TypeError)
|
|
299
|
-
// @ts-ignore: Type testing
|
|
300
|
-
await expect(bee.getAllTags({ offset: [] })).rejects.toThrow(TypeError)
|
|
301
|
-
// @ts-ignore: Type testing
|
|
302
|
-
await expect(bee.getAllTags({ offset: {} })).rejects.toThrow(TypeError)
|
|
303
|
-
// @ts-ignore: Type testing
|
|
304
|
-
await expect(bee.getAllTags({ offset: null })).rejects.toThrow(TypeError)
|
|
305
|
-
|
|
306
|
-
await expect(bee.getAllTags({ offset: -1 })).rejects.toThrow(BeeArgumentError)
|
|
307
|
-
})
|
|
308
|
-
})
|
|
309
|
-
|
|
310
|
-
describe('pin', () => {
|
|
311
|
-
testReferenceAssertions(async (input: unknown) => {
|
|
312
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
313
|
-
|
|
314
|
-
return bee.pin(input as string)
|
|
315
|
-
})
|
|
316
|
-
})
|
|
317
|
-
|
|
318
|
-
describe('unpin', () => {
|
|
319
|
-
testReferenceAssertions(async (input: unknown) => {
|
|
320
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
321
|
-
|
|
322
|
-
return bee.unpin(input as string)
|
|
323
|
-
})
|
|
324
|
-
})
|
|
325
|
-
|
|
326
|
-
describe('getPin', () => {
|
|
327
|
-
testReferenceAssertions(async (input: unknown) => {
|
|
328
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
329
|
-
|
|
330
|
-
return bee.getPin(input as string)
|
|
331
|
-
})
|
|
332
|
-
})
|
|
333
|
-
|
|
334
|
-
describe('reuploadPinnedData', () => {
|
|
335
|
-
testReferenceAssertions(async (input: unknown) => {
|
|
336
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
337
|
-
|
|
338
|
-
return bee.reuploadPinnedData(input as string)
|
|
339
|
-
})
|
|
340
|
-
})
|
|
341
|
-
|
|
342
|
-
describe('pssSend', () => {
|
|
343
|
-
testBatchIdAssertion(async (input: unknown) => {
|
|
344
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
345
|
-
|
|
346
|
-
return bee.pssSend(input as BatchId, 'topic', '123', 'data')
|
|
347
|
-
})
|
|
348
|
-
|
|
349
|
-
testDataAssertions(async (input: unknown) => {
|
|
350
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
351
|
-
|
|
352
|
-
return bee.pssSend(testBatchId, 'topic', '123', input as string)
|
|
353
|
-
})
|
|
354
|
-
|
|
355
|
-
testAddressPrefixAssertions(async (input: unknown) => {
|
|
356
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
357
|
-
|
|
358
|
-
return bee.pssSend(testBatchId, 'topic', input as string, '123')
|
|
359
|
-
})
|
|
360
|
-
|
|
361
|
-
testPublicKeyAssertions(async (input: unknown) => {
|
|
362
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
363
|
-
|
|
364
|
-
return bee.pssSend(testBatchId, 'topic', '123', 'data', input as string)
|
|
365
|
-
})
|
|
366
|
-
|
|
367
|
-
testTopicAssertions(async (input: unknown) => {
|
|
368
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
369
|
-
|
|
370
|
-
return bee.pssSend(testBatchId, input as string, '123', 'data')
|
|
371
|
-
})
|
|
372
|
-
})
|
|
373
|
-
|
|
374
|
-
describe('pssSubscribe', () => {
|
|
375
|
-
testPssMessageHandlerAssertions(async (input: unknown) => {
|
|
376
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
377
|
-
|
|
378
|
-
return bee.pssSubscribe('topic', input as PssMessageHandler)
|
|
379
|
-
})
|
|
380
|
-
|
|
381
|
-
testTopicAssertions(async (input: unknown) => {
|
|
382
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
383
|
-
const handler = {
|
|
384
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
385
|
-
onMessage() {},
|
|
386
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
387
|
-
onError() {},
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
return bee.pssSubscribe(input as string, handler)
|
|
391
|
-
})
|
|
392
|
-
})
|
|
393
|
-
|
|
394
|
-
describe('pssReceive', () => {
|
|
395
|
-
testTopicAssertions(async (input: unknown) => {
|
|
396
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
397
|
-
|
|
398
|
-
return bee.pssReceive(input as string)
|
|
399
|
-
})
|
|
400
|
-
|
|
401
|
-
it('should throw exception for bad Timeout', async () => {
|
|
402
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
403
|
-
|
|
404
|
-
// @ts-ignore: Type testing
|
|
405
|
-
await expect(bee.pssReceive('topic', true)).rejects.toThrow(TypeError)
|
|
406
|
-
// @ts-ignore: Type testing
|
|
407
|
-
await expect(bee.pssReceive('topic', 'asd')).rejects.toThrow(TypeError)
|
|
408
|
-
// @ts-ignore: Type testing
|
|
409
|
-
await expect(bee.pssReceive('topic', [])).rejects.toThrow(TypeError)
|
|
410
|
-
// @ts-ignore: Type testing
|
|
411
|
-
await expect(bee.pssReceive('topic', {})).rejects.toThrow(TypeError)
|
|
412
|
-
})
|
|
413
|
-
})
|
|
414
|
-
|
|
415
|
-
describe('createFeedManifest', () => {
|
|
416
|
-
testBatchIdAssertion(async (input: unknown) => {
|
|
417
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
418
|
-
|
|
419
|
-
return bee.createFeedManifest(input as BatchId, 'epoch', '123', testIdentity.address)
|
|
420
|
-
})
|
|
421
|
-
|
|
422
|
-
testFeedTypeAssertions(async (input: unknown) => {
|
|
423
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
424
|
-
|
|
425
|
-
return bee.createFeedManifest(testBatchId, input as FeedType, '123', testIdentity.address)
|
|
426
|
-
})
|
|
427
|
-
|
|
428
|
-
testFeedTopicAssertions(async (input: unknown) => {
|
|
429
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
430
|
-
|
|
431
|
-
return bee.createFeedManifest(testBatchId, 'epoch', input as string, testIdentity.address)
|
|
432
|
-
})
|
|
433
|
-
|
|
434
|
-
testEthAddressAssertions(async (input: unknown) => {
|
|
435
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
436
|
-
|
|
437
|
-
return bee.createFeedManifest(testBatchId, 'epoch', '123', input as string)
|
|
438
|
-
})
|
|
439
|
-
})
|
|
440
|
-
|
|
441
|
-
describe('makeFeedReader', () => {
|
|
442
|
-
testFeedTypeAssertions(async (input: unknown) => {
|
|
443
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
444
|
-
|
|
445
|
-
return bee.makeFeedReader(input as FeedType, '123', testIdentity.address)
|
|
446
|
-
})
|
|
447
|
-
|
|
448
|
-
testFeedTopicAssertions(async (input: unknown) => {
|
|
449
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
450
|
-
|
|
451
|
-
return bee.makeFeedReader('epoch', input as string, testIdentity.address)
|
|
452
|
-
})
|
|
453
|
-
|
|
454
|
-
testEthAddressAssertions(async (input: unknown) => {
|
|
455
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
456
|
-
|
|
457
|
-
return bee.makeFeedReader('epoch', '123', input as string)
|
|
458
|
-
})
|
|
459
|
-
})
|
|
460
|
-
|
|
461
|
-
describe('makeFeedWriter', () => {
|
|
462
|
-
testFeedTypeAssertions(async (input: unknown) => {
|
|
463
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
464
|
-
|
|
465
|
-
return bee.makeFeedWriter(input as FeedType, '123', testIdentity.privateKey)
|
|
466
|
-
})
|
|
467
|
-
|
|
468
|
-
testFeedTopicAssertions(async (input: unknown) => {
|
|
469
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
470
|
-
|
|
471
|
-
return bee.makeFeedWriter('epoch', input as string, testIdentity.privateKey)
|
|
472
|
-
})
|
|
473
|
-
|
|
474
|
-
testMakeSignerAssertions(async (input: unknown) => {
|
|
475
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
476
|
-
|
|
477
|
-
return bee.makeFeedWriter('epoch', '123', input as string)
|
|
478
|
-
})
|
|
479
|
-
})
|
|
480
|
-
|
|
481
|
-
describe('setJsonFeed', () => {
|
|
482
|
-
testBatchIdAssertion(async (input: unknown) => {
|
|
483
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
484
|
-
|
|
485
|
-
return bee.setJsonFeed(input as BatchId, 'epoch', '123', { signer: testIdentity.privateKey })
|
|
486
|
-
})
|
|
487
|
-
|
|
488
|
-
testFeedTypeAssertions(async (input: unknown) => {
|
|
489
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
490
|
-
|
|
491
|
-
return bee.setJsonFeed(testBatchId, '123', 'data', { type: input as FeedType, signer: testIdentity.privateKey })
|
|
492
|
-
}, false)
|
|
493
|
-
|
|
494
|
-
testTopicAssertions(async (input: unknown) => {
|
|
495
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
496
|
-
|
|
497
|
-
return bee.setJsonFeed('epoch', input as string, 'data', { signer: testIdentity.privateKey })
|
|
498
|
-
})
|
|
499
|
-
|
|
500
|
-
testMakeSignerAssertions(async (input: unknown) => {
|
|
501
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
502
|
-
|
|
503
|
-
return bee.setJsonFeed('epoch', '123', 'data', { signer: input as string })
|
|
504
|
-
})
|
|
505
|
-
})
|
|
506
|
-
|
|
507
|
-
describe('getJsonFeed', () => {
|
|
508
|
-
it('should fetch with specified address', async () => {
|
|
509
|
-
downloadDataMock(testJsonHash).reply(200, testJsonStringPayload)
|
|
510
|
-
fetchFeedUpdateMock(testIdentity.address, HASHED_TOPIC).reply(200, {
|
|
511
|
-
reference: testJsonHash,
|
|
512
|
-
} as ReferenceResponse)
|
|
513
|
-
|
|
514
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
515
|
-
const json = await bee.getJsonFeed(TOPIC, { address: testIdentity.address })
|
|
516
|
-
expect(json).toEqual(testJsonPayload)
|
|
517
|
-
|
|
518
|
-
assertAllIsDone()
|
|
519
|
-
})
|
|
520
|
-
|
|
521
|
-
it('should fetch with specified signer private key', async () => {
|
|
522
|
-
downloadDataMock(testJsonHash).reply(200, testJsonStringPayload)
|
|
523
|
-
fetchFeedUpdateMock(testIdentity.address, HASHED_TOPIC).reply(200, {
|
|
524
|
-
reference: testJsonHash,
|
|
525
|
-
} as ReferenceResponse)
|
|
526
|
-
|
|
527
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
528
|
-
const json = await bee.getJsonFeed(TOPIC, { signer: testIdentity.privateKey })
|
|
529
|
-
expect(json).toEqual(testJsonPayload)
|
|
530
|
-
|
|
531
|
-
assertAllIsDone()
|
|
532
|
-
})
|
|
533
|
-
|
|
534
|
-
it('should fetch with default instance signer', async () => {
|
|
535
|
-
downloadDataMock(testJsonHash).reply(200, testJsonStringPayload)
|
|
536
|
-
fetchFeedUpdateMock(testIdentity.address, HASHED_TOPIC).reply(200, {
|
|
537
|
-
reference: testJsonHash,
|
|
538
|
-
} as ReferenceResponse)
|
|
539
|
-
|
|
540
|
-
const bee = new Bee(MOCK_SERVER_URL, { signer: testIdentity.privateKey })
|
|
541
|
-
const json = await bee.getJsonFeed(TOPIC)
|
|
542
|
-
expect(json).toEqual(testJsonPayload)
|
|
543
|
-
|
|
544
|
-
assertAllIsDone()
|
|
545
|
-
})
|
|
546
|
-
|
|
547
|
-
it('should prioritize address option over default instance signer', async () => {
|
|
548
|
-
downloadDataMock(testJsonHash).reply(200, testJsonStringPayload)
|
|
549
|
-
fetchFeedUpdateMock(testIdentity.address, HASHED_TOPIC).reply(200, {
|
|
550
|
-
reference: testJsonHash,
|
|
551
|
-
} as ReferenceResponse)
|
|
552
|
-
|
|
553
|
-
const bee = new Bee(MOCK_SERVER_URL, {
|
|
554
|
-
// Some other PK
|
|
555
|
-
signer: '634fb5a811196d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd',
|
|
556
|
-
})
|
|
557
|
-
const json = await bee.getJsonFeed(TOPIC, { address: testIdentity.address })
|
|
558
|
-
expect(json).toEqual(testJsonPayload)
|
|
559
|
-
|
|
560
|
-
assertAllIsDone()
|
|
561
|
-
})
|
|
562
|
-
|
|
563
|
-
it('should prioritize signer option over default instance signer', async () => {
|
|
564
|
-
downloadDataMock(testJsonHash).reply(200, testJsonStringPayload)
|
|
565
|
-
fetchFeedUpdateMock(testIdentity.address, HASHED_TOPIC).reply(200, {
|
|
566
|
-
reference: testJsonHash,
|
|
567
|
-
} as ReferenceResponse)
|
|
568
|
-
|
|
569
|
-
const bee = new Bee(MOCK_SERVER_URL, {
|
|
570
|
-
// Some other PK
|
|
571
|
-
signer: '634fb5a811196d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd',
|
|
572
|
-
})
|
|
573
|
-
const json = await bee.getJsonFeed(TOPIC, { signer: testIdentity.privateKey })
|
|
574
|
-
expect(json).toEqual(testJsonPayload)
|
|
575
|
-
|
|
576
|
-
assertAllIsDone()
|
|
577
|
-
})
|
|
578
|
-
|
|
579
|
-
it('should fail when both signer and address options are specified', async () => {
|
|
580
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
581
|
-
|
|
582
|
-
await expect(
|
|
583
|
-
bee.getJsonFeed(TOPIC, { address: testIdentity.address, signer: testIdentity.privateKey }),
|
|
584
|
-
).rejects.toThrow()
|
|
585
|
-
})
|
|
586
|
-
|
|
587
|
-
it('should fail if no signer or address is specified', async () => {
|
|
588
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
589
|
-
|
|
590
|
-
await expect(bee.getJsonFeed(TOPIC)).rejects.toThrow()
|
|
591
|
-
})
|
|
592
|
-
})
|
|
593
|
-
|
|
594
|
-
describe('makeSOCReader', () => {
|
|
595
|
-
testEthAddressAssertions(async (input: unknown) => {
|
|
596
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
597
|
-
|
|
598
|
-
return bee.makeSOCReader(input as string)
|
|
599
|
-
})
|
|
600
|
-
})
|
|
601
|
-
|
|
602
|
-
describe('makeSOCWriter', () => {
|
|
603
|
-
testMakeSignerAssertions(async (input: unknown) => {
|
|
604
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
605
|
-
|
|
606
|
-
return bee.makeSOCWriter(input as string)
|
|
607
|
-
}, false)
|
|
608
|
-
})
|
|
609
|
-
|
|
610
|
-
describe('createPostageBatch', () => {
|
|
611
|
-
const BATCH_ID = '36b7efd913ca4cf880b8eeac5093fa27b0825906c600685b6abdd6566e6cfe8f'
|
|
612
|
-
const BATCH_RESPONSE = {
|
|
613
|
-
batchID: BATCH_ID,
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
it('should not pass headers if no gas price is specified', async () => {
|
|
617
|
-
createPostageBatchMock('10', '17').reply(201, BATCH_RESPONSE)
|
|
618
|
-
|
|
619
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
620
|
-
await expect(bee.createPostageBatch('10', 17)).resolves.toEqual(BATCH_ID)
|
|
621
|
-
assertAllIsDone()
|
|
622
|
-
})
|
|
623
|
-
|
|
624
|
-
it('should pass headers if gas price is specified', async () => {
|
|
625
|
-
createPostageBatchMock('10', '17', '100').reply(201, BATCH_RESPONSE)
|
|
626
|
-
|
|
627
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
628
|
-
await expect(bee.createPostageBatch('10', 17, { gasPrice: '100' })).resolves.toEqual(BATCH_ID)
|
|
629
|
-
assertAllIsDone()
|
|
630
|
-
})
|
|
631
|
-
|
|
632
|
-
it('should pass headers if immutable flag is specified', async () => {
|
|
633
|
-
createPostageBatchMock('10', '17', undefined, undefined, 'true').reply(201, BATCH_RESPONSE)
|
|
634
|
-
|
|
635
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
636
|
-
await expect(bee.createPostageBatch('10', 17, { immutableFlag: true })).resolves.toEqual(BATCH_ID)
|
|
637
|
-
assertAllIsDone()
|
|
638
|
-
})
|
|
639
|
-
|
|
640
|
-
it('should throw error if passed wrong gas price input', async () => {
|
|
641
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
642
|
-
|
|
643
|
-
// @ts-ignore: Input testing
|
|
644
|
-
await expect(bee.createPostageBatch('10', 17, { gasPrice: 'asd' })).rejects.toThrow(TypeError)
|
|
645
|
-
|
|
646
|
-
// @ts-ignore: Input testing
|
|
647
|
-
await expect(bee.createPostageBatch('10', 17, { gasPrice: true })).rejects.toThrow(TypeError)
|
|
648
|
-
await expect(bee.createPostageBatch('10', 17, { gasPrice: '-1' })).rejects.toThrow(BeeArgumentError)
|
|
649
|
-
})
|
|
650
|
-
|
|
651
|
-
it('should throw error if passed wrong immutable input', async () => {
|
|
652
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
653
|
-
|
|
654
|
-
// @ts-ignore: Input testing
|
|
655
|
-
await expect(bee.createPostageBatch('10', 17, { immutableFlag: 'asd' })).rejects.toThrow(TypeError)
|
|
656
|
-
|
|
657
|
-
// @ts-ignore: Input testing
|
|
658
|
-
await expect(bee.createPostageBatch('10', 17, { immutableFlag: -1 })).rejects.toThrow(TypeError)
|
|
659
|
-
|
|
660
|
-
// @ts-ignore: Input testing
|
|
661
|
-
await expect(bee.createPostageBatch('10', 17, { immutableFlag: 'true' })).rejects.toThrow(TypeError)
|
|
662
|
-
})
|
|
663
|
-
|
|
664
|
-
it('should throw error if too small depth', async () => {
|
|
665
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
666
|
-
|
|
667
|
-
await expect(bee.createPostageBatch('10', -1)).rejects.toThrow(BeeArgumentError)
|
|
668
|
-
await expect(bee.createPostageBatch('10', 15)).rejects.toThrow(BeeArgumentError)
|
|
669
|
-
})
|
|
670
|
-
|
|
671
|
-
it('should throw error if too big depth', async () => {
|
|
672
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
673
|
-
|
|
674
|
-
await expect(bee.createPostageBatch('10', 256)).rejects.toThrow(BeeArgumentError)
|
|
675
|
-
})
|
|
676
|
-
})
|
|
677
|
-
|
|
678
|
-
describe('getPostageBatch', () => {
|
|
679
|
-
testBatchIdAssertion(async (input: unknown) => {
|
|
680
|
-
const bee = new Bee(MOCK_SERVER_URL)
|
|
681
|
-
|
|
682
|
-
return bee.getPostageBatch(input as BatchId)
|
|
683
|
-
})
|
|
684
|
-
})
|
|
685
|
-
})
|