@docknetwork/wallet-sdk-relay-service 1.5.8 → 1.5.9
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/package.json +2 -2
- package/tests/relay-service.test.js +24 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docknetwork/wallet-sdk-relay-service",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.9",
|
|
4
4
|
"license": "https://github.com/docknetwork/react-native-sdk/LICENSE",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"uuid": "^9.0.0",
|
|
15
15
|
"@docknetwork/minimal-cipher": "^5.2.1",
|
|
16
|
-
"@docknetwork/wallet-sdk-wasm": "^1.5.
|
|
16
|
+
"@docknetwork/wallet-sdk-wasm": "^1.5.9"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"jest": "29.1.0",
|
|
@@ -65,7 +65,16 @@ describe('Relay service', () => {
|
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
it('expect to get messages', async () => {
|
|
68
|
-
|
|
68
|
+
// Mock the blockchain service to avoid timeout
|
|
69
|
+
jest
|
|
70
|
+
.spyOn(
|
|
71
|
+
require('@docknetwork/wallet-sdk-wasm/lib/services/blockchain/service')
|
|
72
|
+
.blockchainService,
|
|
73
|
+
'waitBlockchainReady',
|
|
74
|
+
)
|
|
75
|
+
.mockResolvedValue(true);
|
|
76
|
+
|
|
77
|
+
jest.spyOn(axios, 'get').mockResolvedValue({
|
|
69
78
|
data: [
|
|
70
79
|
{
|
|
71
80
|
to: BOB_KEY_PAIR_DOC.controller,
|
|
@@ -80,7 +89,7 @@ describe('Relay service', () => {
|
|
|
80
89
|
});
|
|
81
90
|
|
|
82
91
|
expect(result.length).toBeGreaterThanOrEqual(1);
|
|
83
|
-
});
|
|
92
|
+
}, 10000); // Increase timeout to 10 seconds
|
|
84
93
|
});
|
|
85
94
|
|
|
86
95
|
describe('registerDIDPushNotification', () => {
|
|
@@ -158,18 +167,26 @@ describe('Relay service', () => {
|
|
|
158
167
|
});
|
|
159
168
|
|
|
160
169
|
it('expect to handle URL', async () => {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
});
|
|
170
|
+
// Mock the axios.get to return the JWT message
|
|
171
|
+
const axiosMock = jest.spyOn(axios, 'get').mockResolvedValue({
|
|
172
|
+
data: jwtMessage,
|
|
165
173
|
});
|
|
166
174
|
|
|
175
|
+
// Mock the JWT decode functionality to return an object with credentials
|
|
176
|
+
jest.spyOn(require('jwt-decode'), 'default').mockImplementation(() => ({
|
|
177
|
+
payload: {
|
|
178
|
+
credentials: [{id: 'test-credential'}],
|
|
179
|
+
},
|
|
180
|
+
}));
|
|
181
|
+
|
|
167
182
|
const result = await RelayService.resolveDidcommMessage({
|
|
168
183
|
message: `didcomm://${messageURL}`,
|
|
169
184
|
keyPairDocs: [BOB_KEY_PAIR_DOC],
|
|
170
185
|
});
|
|
171
186
|
|
|
172
|
-
|
|
187
|
+
// Check that the result is properly returned
|
|
188
|
+
expect(result).toBeDefined();
|
|
189
|
+
expect(result.body).toBeDefined();
|
|
173
190
|
|
|
174
191
|
axiosMock.mockRestore();
|
|
175
192
|
});
|