@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,20 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
|
|
3
|
-
<html lang="en">
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<title>BeeJS testing page - Upload</title>
|
|
7
|
-
<script src="../../dist/index.browser.js"></script>
|
|
8
|
-
</head>
|
|
9
|
-
|
|
10
|
-
<body>
|
|
11
|
-
<div>
|
|
12
|
-
<!-- Upload file -->
|
|
13
|
-
<input type="file" id="upload-file" />
|
|
14
|
-
</div>
|
|
15
|
-
<div>
|
|
16
|
-
<!-- Upload directory -->
|
|
17
|
-
<input type="file" id="upload-directory" webkitdirectory mozdirectory />
|
|
18
|
-
</div>
|
|
19
|
-
</body>
|
|
20
|
-
</html>
|
package/test/unit/assertions.ts
DELETED
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
import { BeeArgumentError } from '../../src'
|
|
3
|
-
import { makeBytes } from '../../src/utils/bytes'
|
|
4
|
-
|
|
5
|
-
export function testBatchIdAssertion(executor: (input: unknown) => void): void {
|
|
6
|
-
it('should throw exception for bad BatchId', async () => {
|
|
7
|
-
await expect(() => executor(1)).rejects.toThrow(TypeError)
|
|
8
|
-
await expect(() => executor(true)).rejects.toThrow(TypeError)
|
|
9
|
-
await expect(() => executor({})).rejects.toThrow(TypeError)
|
|
10
|
-
await expect(() => executor(null)).rejects.toThrow(TypeError)
|
|
11
|
-
await expect(() => executor(undefined)).rejects.toThrow(TypeError)
|
|
12
|
-
await expect(() => executor([])).rejects.toThrow(TypeError)
|
|
13
|
-
await expect(() => executor('')).rejects.toThrow(TypeError)
|
|
14
|
-
|
|
15
|
-
// Not an valid hexstring (ZZZ)
|
|
16
|
-
await expect(() => executor('ZZZfb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
17
|
-
TypeError,
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
// Prefixed hexstring is not accepted
|
|
21
|
-
await expect(() => executor('0x634fb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
22
|
-
TypeError,
|
|
23
|
-
)
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function testDataAssertions(executor: (input: unknown) => void): void {
|
|
28
|
-
it('should throw exception for bad Data', async () => {
|
|
29
|
-
await expect(() => executor(1)).rejects.toThrow(TypeError)
|
|
30
|
-
await expect(() => executor(true)).rejects.toThrow(TypeError)
|
|
31
|
-
await expect(() => executor(null)).rejects.toThrow(TypeError)
|
|
32
|
-
await expect(() => executor(undefined)).rejects.toThrow(TypeError)
|
|
33
|
-
await expect(() => executor([])).rejects.toThrow(TypeError)
|
|
34
|
-
await expect(() => executor({})).rejects.toThrow(TypeError)
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function testFileDataAssertions(executor: (input: unknown) => void): void {
|
|
39
|
-
it('should throw exception for bad FileData', async () => {
|
|
40
|
-
await expect(() => executor(1)).rejects.toThrow(TypeError)
|
|
41
|
-
await expect(() => executor(true)).rejects.toThrow(TypeError)
|
|
42
|
-
await expect(() => executor(null)).rejects.toThrow(TypeError)
|
|
43
|
-
await expect(() => executor(undefined)).rejects.toThrow(TypeError)
|
|
44
|
-
await expect(() => executor([])).rejects.toThrow(TypeError)
|
|
45
|
-
await expect(() => executor({})).rejects.toThrow(TypeError)
|
|
46
|
-
await expect(() => executor({ name: 'some file' })).rejects.toThrow(TypeError)
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
48
|
-
await expect(() => executor({ pipe: () => {} })).rejects.toThrow(TypeError)
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function testUploadOptionsAssertions(executor: (input: unknown) => void): void {
|
|
53
|
-
it('should throw exception for bad UploadOptions', async () => {
|
|
54
|
-
await expect(() => executor(1)).rejects.toThrow(TypeError)
|
|
55
|
-
await expect(() => executor(true)).rejects.toThrow(TypeError)
|
|
56
|
-
await expect(() => executor([])).rejects.toThrow(TypeError)
|
|
57
|
-
await expect(() => executor('string')).rejects.toThrow(TypeError)
|
|
58
|
-
|
|
59
|
-
await expect(() => executor({ pin: 'plur' })).rejects.toThrow(TypeError)
|
|
60
|
-
await expect(() => executor({ pin: 1 })).rejects.toThrow(TypeError)
|
|
61
|
-
await expect(() => executor({ pin: {} })).rejects.toThrow(TypeError)
|
|
62
|
-
await expect(() => executor({ pin: [] })).rejects.toThrow(TypeError)
|
|
63
|
-
|
|
64
|
-
await expect(() => executor({ encrypt: 'plur' })).rejects.toThrow(TypeError)
|
|
65
|
-
await expect(() => executor({ encrypt: 1 })).rejects.toThrow(TypeError)
|
|
66
|
-
await expect(() => executor({ encrypt: {} })).rejects.toThrow(TypeError)
|
|
67
|
-
await expect(() => executor({ encrypt: [] })).rejects.toThrow(TypeError)
|
|
68
|
-
|
|
69
|
-
await expect(() => executor({ tag: 'plur' })).rejects.toThrow(TypeError)
|
|
70
|
-
await expect(() => executor({ tag: true })).rejects.toThrow(TypeError)
|
|
71
|
-
await expect(() => executor({ tag: {} })).rejects.toThrow(TypeError)
|
|
72
|
-
await expect(() => executor({ tag: [] })).rejects.toThrow(TypeError)
|
|
73
|
-
await expect(() => executor({ tag: -1 })).rejects.toThrow(BeeArgumentError)
|
|
74
|
-
|
|
75
|
-
await expect(() => executor({ axiosOptions: 'plur' })).rejects.toThrow(TypeError)
|
|
76
|
-
await expect(() => executor({ axiosOptions: true })).rejects.toThrow(TypeError)
|
|
77
|
-
await expect(() => executor({ axiosOptions: [] })).rejects.toThrow(TypeError)
|
|
78
|
-
await expect(() => executor({ axiosOptions: -1 })).rejects.toThrow(TypeError)
|
|
79
|
-
})
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export function testFileUploadOptionsAssertions(executor: (input: unknown) => void): void {
|
|
83
|
-
it('should throw exception for bad FileUploadOptions', async () => {
|
|
84
|
-
await expect(() => executor({ contentType: true })).rejects.toThrow(TypeError)
|
|
85
|
-
await expect(() => executor({ contentType: 1 })).rejects.toThrow(TypeError)
|
|
86
|
-
await expect(() => executor({ contentType: {} })).rejects.toThrow(TypeError)
|
|
87
|
-
await expect(() => executor({ contentType: [] })).rejects.toThrow(TypeError)
|
|
88
|
-
|
|
89
|
-
await expect(() => executor({ size: 'plur' })).rejects.toThrow(TypeError)
|
|
90
|
-
await expect(() => executor({ size: true })).rejects.toThrow(TypeError)
|
|
91
|
-
await expect(() => executor({ size: {} })).rejects.toThrow(TypeError)
|
|
92
|
-
await expect(() => executor({ size: [] })).rejects.toThrow(TypeError)
|
|
93
|
-
await expect(() => executor({ size: -1 })).rejects.toThrow(BeeArgumentError)
|
|
94
|
-
})
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function testCollectionUploadOptionsAssertions(executor: (input: unknown) => void): void {
|
|
98
|
-
it('should throw exception for bad CollectionUploadOptions', async () => {
|
|
99
|
-
await expect(() => executor({ indexDocument: true })).rejects.toThrow(TypeError)
|
|
100
|
-
await expect(() => executor({ indexDocument: 1 })).rejects.toThrow(TypeError)
|
|
101
|
-
await expect(() => executor({ indexDocument: {} })).rejects.toThrow(TypeError)
|
|
102
|
-
await expect(() => executor({ indexDocument: [] })).rejects.toThrow(TypeError)
|
|
103
|
-
|
|
104
|
-
await expect(() => executor({ errorDocument: true })).rejects.toThrow(TypeError)
|
|
105
|
-
await expect(() => executor({ errorDocument: 1 })).rejects.toThrow(TypeError)
|
|
106
|
-
await expect(() => executor({ errorDocument: {} })).rejects.toThrow(TypeError)
|
|
107
|
-
await expect(() => executor({ errorDocument: [] })).rejects.toThrow(TypeError)
|
|
108
|
-
})
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export function testReferenceAssertions(executor: (input: unknown) => void): void {
|
|
112
|
-
it('should throw exception for bad Reference', async () => {
|
|
113
|
-
await expect(() => executor(1)).rejects.toThrow(TypeError)
|
|
114
|
-
await expect(() => executor(true)).rejects.toThrow(TypeError)
|
|
115
|
-
await expect(() => executor({})).rejects.toThrow(TypeError)
|
|
116
|
-
await expect(() => executor(null)).rejects.toThrow(TypeError)
|
|
117
|
-
await expect(() => executor(undefined)).rejects.toThrow(TypeError)
|
|
118
|
-
await expect(() => executor([])).rejects.toThrow(TypeError)
|
|
119
|
-
await expect(() => executor('')).rejects.toThrow(TypeError)
|
|
120
|
-
|
|
121
|
-
// Not an valid hexstring (ZZZ)
|
|
122
|
-
await expect(() => executor('ZZZfb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
123
|
-
TypeError,
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
// Prefixed hexstring is not accepted
|
|
127
|
-
await expect(() => executor('0x634fb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
128
|
-
TypeError,
|
|
129
|
-
)
|
|
130
|
-
|
|
131
|
-
// Length mismatch
|
|
132
|
-
await expect(() => executor('4fb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
133
|
-
TypeError,
|
|
134
|
-
)
|
|
135
|
-
})
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export function testAddressPrefixAssertions(executor: (input: unknown) => void): void {
|
|
139
|
-
it('should throw exception for bad AddressPrefix', async () => {
|
|
140
|
-
await expect(() => executor(1)).rejects.toThrow(TypeError)
|
|
141
|
-
await expect(() => executor(true)).rejects.toThrow(TypeError)
|
|
142
|
-
await expect(() => executor({})).rejects.toThrow(TypeError)
|
|
143
|
-
await expect(() => executor(null)).rejects.toThrow(TypeError)
|
|
144
|
-
await expect(() => executor(undefined)).rejects.toThrow(TypeError)
|
|
145
|
-
await expect(() => executor([])).rejects.toThrow(TypeError)
|
|
146
|
-
await expect(() => executor('')).rejects.toThrow(TypeError)
|
|
147
|
-
|
|
148
|
-
// Not an valid hexstring (ZZZ)
|
|
149
|
-
await expect(() => executor('ZZZfb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
150
|
-
TypeError,
|
|
151
|
-
)
|
|
152
|
-
|
|
153
|
-
// Prefixed hexstring is not accepted
|
|
154
|
-
await expect(() => executor('0x634fb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
155
|
-
TypeError,
|
|
156
|
-
)
|
|
157
|
-
|
|
158
|
-
// Too long hexstring
|
|
159
|
-
await expect(() => executor('123634fb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
160
|
-
BeeArgumentError,
|
|
161
|
-
)
|
|
162
|
-
})
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export function testPublicKeyAssertions(executor: (input: unknown) => void): void {
|
|
166
|
-
it('should throw exception for bad PublicKey', async () => {
|
|
167
|
-
await expect(() => executor(1)).rejects.toThrow(TypeError)
|
|
168
|
-
await expect(() => executor(true)).rejects.toThrow(TypeError)
|
|
169
|
-
await expect(() => executor({})).rejects.toThrow(TypeError)
|
|
170
|
-
await expect(() => executor([])).rejects.toThrow(TypeError)
|
|
171
|
-
|
|
172
|
-
// Not an valid hexstring (ZZZ)
|
|
173
|
-
await expect(() => executor('ZZZfb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
174
|
-
TypeError,
|
|
175
|
-
)
|
|
176
|
-
|
|
177
|
-
// Prefixed hexstring is not accepted
|
|
178
|
-
await expect(() => executor('0x634fb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
179
|
-
TypeError,
|
|
180
|
-
)
|
|
181
|
-
|
|
182
|
-
// Length mismatch
|
|
183
|
-
await expect(() => executor('4fb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
184
|
-
TypeError,
|
|
185
|
-
)
|
|
186
|
-
})
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export function testPssMessageHandlerAssertions(executor: (input: unknown) => void): void {
|
|
190
|
-
it('should throw exception for bad PssMessageHandler', async () => {
|
|
191
|
-
await expect(() => executor(1)).rejects.toThrow(TypeError)
|
|
192
|
-
await expect(() => executor(true)).rejects.toThrow(TypeError)
|
|
193
|
-
await expect(() => executor({})).rejects.toThrow(TypeError)
|
|
194
|
-
await expect(() => executor(null)).rejects.toThrow(TypeError)
|
|
195
|
-
await expect(() => executor(undefined)).rejects.toThrow(TypeError)
|
|
196
|
-
await expect(() => executor([])).rejects.toThrow(TypeError)
|
|
197
|
-
await expect(() => executor('')).rejects.toThrow(TypeError)
|
|
198
|
-
|
|
199
|
-
await expect(() => {
|
|
200
|
-
return executor({ onMessage() {} })
|
|
201
|
-
}).rejects.toThrow(TypeError)
|
|
202
|
-
|
|
203
|
-
await expect(() => {
|
|
204
|
-
return executor({ onMessage() {}, onError: '' })
|
|
205
|
-
}).rejects.toThrow(TypeError)
|
|
206
|
-
|
|
207
|
-
await expect(() => {
|
|
208
|
-
return executor({ onMessage() {}, onError: [] })
|
|
209
|
-
}).rejects.toThrow(TypeError)
|
|
210
|
-
|
|
211
|
-
await expect(() => {
|
|
212
|
-
return executor({ onMessage() {}, onError: {} })
|
|
213
|
-
}).rejects.toThrow(TypeError)
|
|
214
|
-
|
|
215
|
-
await expect(() => {
|
|
216
|
-
return executor({ onMessage() {}, onError: true })
|
|
217
|
-
}).rejects.toThrow(TypeError)
|
|
218
|
-
|
|
219
|
-
await expect(() => {
|
|
220
|
-
return executor({ onError() {}, onMessage: true })
|
|
221
|
-
}).rejects.toThrow(TypeError)
|
|
222
|
-
|
|
223
|
-
await expect(() => {
|
|
224
|
-
return executor({ onError() {}, onMessage: {} })
|
|
225
|
-
}).rejects.toThrow(TypeError)
|
|
226
|
-
|
|
227
|
-
await expect(() => {
|
|
228
|
-
return executor({ onError() {}, onMessage: [] })
|
|
229
|
-
}).rejects.toThrow(TypeError)
|
|
230
|
-
|
|
231
|
-
await expect(() => {
|
|
232
|
-
return executor({ onError() {}, onMessage: '' })
|
|
233
|
-
}).rejects.toThrow(TypeError)
|
|
234
|
-
|
|
235
|
-
await expect(() => {
|
|
236
|
-
return executor({ onError() {}, onMessage: 1 })
|
|
237
|
-
}).rejects.toThrow(TypeError)
|
|
238
|
-
})
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export function testTopicAssertions(executor: (input: unknown) => void): void {
|
|
242
|
-
it('should throw exception for bad Topic', async () => {
|
|
243
|
-
await expect(() => executor(1)).rejects.toThrow(TypeError)
|
|
244
|
-
await expect(() => executor(true)).rejects.toThrow(TypeError)
|
|
245
|
-
await expect(() => executor({})).rejects.toThrow(TypeError)
|
|
246
|
-
await expect(() => executor(null)).rejects.toThrow(TypeError)
|
|
247
|
-
await expect(() => executor(undefined)).rejects.toThrow(TypeError)
|
|
248
|
-
await expect(() => executor([])).rejects.toThrow(TypeError)
|
|
249
|
-
})
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
export function testFeedTopicAssertions(executor: (input: unknown) => void): void {
|
|
253
|
-
it('should throw exception for bad Topic', async () => {
|
|
254
|
-
await expect(() => executor(1)).rejects.toThrow(TypeError)
|
|
255
|
-
await expect(() => executor(true)).rejects.toThrow(TypeError)
|
|
256
|
-
await expect(() => executor({})).rejects.toThrow(TypeError)
|
|
257
|
-
await expect(() => executor(null)).rejects.toThrow(TypeError)
|
|
258
|
-
await expect(() => executor(undefined)).rejects.toThrow(TypeError)
|
|
259
|
-
await expect(() => executor([])).rejects.toThrow(TypeError)
|
|
260
|
-
|
|
261
|
-
// Not an valid hexstring (ZZZ)
|
|
262
|
-
await expect(() => executor('ZZZfb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
263
|
-
TypeError,
|
|
264
|
-
)
|
|
265
|
-
|
|
266
|
-
// Length mismatch
|
|
267
|
-
await expect(() => executor('4fb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
268
|
-
TypeError,
|
|
269
|
-
)
|
|
270
|
-
})
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
export function testEthAddressAssertions(executor: (input: unknown) => void): void {
|
|
274
|
-
it('should throw exception for bad EthAddress', async () => {
|
|
275
|
-
await expect(() => executor(1)).rejects.toThrow(TypeError)
|
|
276
|
-
await expect(() => executor(true)).rejects.toThrow(TypeError)
|
|
277
|
-
await expect(() => executor({})).rejects.toThrow(TypeError)
|
|
278
|
-
await expect(() => executor(null)).rejects.toThrow(TypeError)
|
|
279
|
-
await expect(() => executor(undefined)).rejects.toThrow(TypeError)
|
|
280
|
-
await expect(() => executor([])).rejects.toThrow(TypeError)
|
|
281
|
-
|
|
282
|
-
// Not an valid hexstring (ZZZ)
|
|
283
|
-
await expect(() => executor('ZZZfb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
284
|
-
TypeError,
|
|
285
|
-
)
|
|
286
|
-
|
|
287
|
-
// Length mismatch
|
|
288
|
-
await expect(() => executor('4fb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
289
|
-
TypeError,
|
|
290
|
-
)
|
|
291
|
-
|
|
292
|
-
// Bytes length mismatch
|
|
293
|
-
await expect(() => executor(makeBytes(19))).rejects.toThrow(TypeError)
|
|
294
|
-
})
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
export function testMakeSignerAssertions(executor: (input: unknown) => void, optionals = true): void {
|
|
298
|
-
it('should throw exception for bad Signer', async () => {
|
|
299
|
-
await expect(() => executor(1)).rejects.toThrow(TypeError)
|
|
300
|
-
await expect(() => executor(true)).rejects.toThrow(TypeError)
|
|
301
|
-
await expect(() => executor({})).rejects.toThrow(TypeError)
|
|
302
|
-
await expect(() => executor([])).rejects.toThrow(TypeError)
|
|
303
|
-
|
|
304
|
-
if (optionals) {
|
|
305
|
-
await expect(() => executor(null)).rejects.toThrow(TypeError)
|
|
306
|
-
await expect(() => executor(undefined)).rejects.toThrow(TypeError)
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
// Not an valid hexstring (ZZZ)
|
|
310
|
-
await expect(() => executor('ZZZfb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
311
|
-
TypeError,
|
|
312
|
-
)
|
|
313
|
-
|
|
314
|
-
// Hex Length mismatch
|
|
315
|
-
await expect(() => executor('4fb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
316
|
-
TypeError,
|
|
317
|
-
)
|
|
318
|
-
|
|
319
|
-
// Bytes Length mismatch
|
|
320
|
-
await expect(() => executor(makeBytes(31))).rejects.toThrow(TypeError)
|
|
321
|
-
|
|
322
|
-
await expect(() => executor({ address: makeBytes(19), sign: () => {} })).rejects.toThrow(TypeError)
|
|
323
|
-
await expect(() => executor({ address: '', sign: () => {} })).rejects.toThrow(TypeError)
|
|
324
|
-
await expect(() => executor({ address: undefined, sign: () => {} })).rejects.toThrow(TypeError)
|
|
325
|
-
await expect(() => executor({ address: null, sign: () => {} })).rejects.toThrow(TypeError)
|
|
326
|
-
await expect(() => executor({ address: [], sign: () => {} })).rejects.toThrow(TypeError)
|
|
327
|
-
await expect(() => executor({ address: {}, sign: () => {} })).rejects.toThrow(TypeError)
|
|
328
|
-
await expect(() => executor({ address: makeBytes(20), sign: null })).rejects.toThrow(TypeError)
|
|
329
|
-
await expect(() => executor({ address: makeBytes(20), sign: undefined })).rejects.toThrow(TypeError)
|
|
330
|
-
await expect(() => executor({ address: makeBytes(20), sign: 'asd' })).rejects.toThrow(TypeError)
|
|
331
|
-
await expect(() => executor({ address: makeBytes(20), sign: [] })).rejects.toThrow(TypeError)
|
|
332
|
-
await expect(() => executor({ address: makeBytes(20), sign: {} })).rejects.toThrow(TypeError)
|
|
333
|
-
})
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
export function testFeedTypeAssertions(executor: (input: unknown) => void, optionals = true): void {
|
|
337
|
-
it('should throw exception for bad FeedType', async () => {
|
|
338
|
-
await expect(() => executor(1)).rejects.toThrow(TypeError)
|
|
339
|
-
await expect(() => executor(true)).rejects.toThrow(TypeError)
|
|
340
|
-
await expect(() => executor({})).rejects.toThrow(TypeError)
|
|
341
|
-
await expect(() => executor([])).rejects.toThrow(TypeError)
|
|
342
|
-
await expect(() => executor('asd')).rejects.toThrow(TypeError)
|
|
343
|
-
|
|
344
|
-
if (optionals) {
|
|
345
|
-
await expect(() => executor('')).rejects.toThrow(TypeError)
|
|
346
|
-
await expect(() => executor(null)).rejects.toThrow(TypeError)
|
|
347
|
-
await expect(() => executor(undefined)).rejects.toThrow(TypeError)
|
|
348
|
-
}
|
|
349
|
-
})
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
export function testAddressAssertions(executor: (input: unknown) => void, optionals = true): void {
|
|
353
|
-
it('should throw exception for bad Address', async () => {
|
|
354
|
-
await expect(() => executor(1)).rejects.toThrow(TypeError)
|
|
355
|
-
await expect(() => executor(true)).rejects.toThrow(TypeError)
|
|
356
|
-
await expect(() => executor({})).rejects.toThrow(TypeError)
|
|
357
|
-
await expect(() => executor([])).rejects.toThrow(TypeError)
|
|
358
|
-
await expect(() => executor('asd')).rejects.toThrow(TypeError)
|
|
359
|
-
|
|
360
|
-
// Not an valid hexstring (ZZZ)
|
|
361
|
-
await expect(() => executor('ZZZfb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
362
|
-
TypeError,
|
|
363
|
-
)
|
|
364
|
-
|
|
365
|
-
// Hex Length mismatch
|
|
366
|
-
await expect(() => executor('4fb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd')).rejects.toThrow(
|
|
367
|
-
TypeError,
|
|
368
|
-
)
|
|
369
|
-
|
|
370
|
-
if (optionals) {
|
|
371
|
-
await expect(() => executor('')).rejects.toThrow(TypeError)
|
|
372
|
-
await expect(() => executor(null)).rejects.toThrow(TypeError)
|
|
373
|
-
await expect(() => executor(undefined)).rejects.toThrow(TypeError)
|
|
374
|
-
}
|
|
375
|
-
})
|
|
376
|
-
}
|