@adobe/aio-cli-plugin-api-mesh 1.3.0 → 2.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/README.md +4 -3
- package/oclif.manifest.json +1 -1
- package/package.json +16 -16
- package/src/commands/api-mesh/__tests__/create.test.js +136 -133
- package/src/commands/api-mesh/__tests__/delete.test.js +40 -40
- package/src/commands/api-mesh/__tests__/describe.test.js +30 -40
- package/src/commands/api-mesh/__tests__/get.test.js +60 -69
- package/src/commands/api-mesh/__tests__/update.test.js +71 -35
- package/src/commands/api-mesh/create.js +20 -5
- package/src/commands/api-mesh/describe.js +1 -1
- package/src/commands/api-mesh/get.js +1 -1
- package/src/commands/api-mesh/source/__fixtures__/0.0.1-test-01.json +1 -1
- package/src/commands/api-mesh/source/__fixtures__/0.0.1-test-02.json +1 -1
- package/src/commands/api-mesh/source/__tests__/discover.test.js +10 -9
- package/src/commands/api-mesh/source/__tests__/get.test.js +30 -24
- package/src/commands/api-mesh/source/__tests__/install.test.js +27 -11
- package/src/commands/api-mesh/source/discover.js +65 -6
- package/src/commands/api-mesh/source/get.js +28 -15
- package/src/commands/api-mesh/source/install.js +64 -34
- package/src/commands/api-mesh/status.js +96 -0
- package/src/commands/api-mesh/update.js +12 -1
- package/src/constants.js +2 -0
- package/src/helpers.js +16 -10
- package/src/utils.js +7 -2
|
@@ -89,8 +89,8 @@ describe('delete command tests', () => {
|
|
|
89
89
|
expect(DeleteCommand.description).toMatchInlineSnapshot(`"Delete the config of a given mesh"`);
|
|
90
90
|
expect(DeleteCommand.args).toMatchInlineSnapshot(`undefined`);
|
|
91
91
|
expect(DeleteCommand.flags).toMatchInlineSnapshot(`
|
|
92
|
-
|
|
93
|
-
"autoConfirmAction":
|
|
92
|
+
{
|
|
93
|
+
"autoConfirmAction": {
|
|
94
94
|
"allowNo": false,
|
|
95
95
|
"char": "c",
|
|
96
96
|
"default": false,
|
|
@@ -98,7 +98,7 @@ describe('delete command tests', () => {
|
|
|
98
98
|
"parse": [Function],
|
|
99
99
|
"type": "boolean",
|
|
100
100
|
},
|
|
101
|
-
"ignoreCache":
|
|
101
|
+
"ignoreCache": {
|
|
102
102
|
"allowNo": false,
|
|
103
103
|
"char": "i",
|
|
104
104
|
"default": false,
|
|
@@ -108,7 +108,7 @@ describe('delete command tests', () => {
|
|
|
108
108
|
},
|
|
109
109
|
}
|
|
110
110
|
`);
|
|
111
|
-
expect(DeleteCommand.aliases).toMatchInlineSnapshot(`
|
|
111
|
+
expect(DeleteCommand.aliases).toMatchInlineSnapshot(`[]`);
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
test('should fail if mesh id is missing', async () => {
|
|
@@ -119,10 +119,10 @@ describe('delete command tests', () => {
|
|
|
119
119
|
expect(err.message).toMatchInlineSnapshot(
|
|
120
120
|
`"Unable to delete. No mesh found for Org(1234) -> Project(5678) -> Workspace(123456789). Please check the details and try again."`,
|
|
121
121
|
);
|
|
122
|
-
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
122
|
+
expect(logSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
123
123
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
[
|
|
125
|
+
[
|
|
126
126
|
"Unable to delete. No mesh found for Org(1234) -> Project(5678) -> Workspace(123456789). Please check the details and try again.",
|
|
127
127
|
],
|
|
128
128
|
]
|
|
@@ -137,13 +137,13 @@ describe('delete command tests', () => {
|
|
|
137
137
|
|
|
138
138
|
expect(runResult).toBe('Delete cancelled');
|
|
139
139
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
[
|
|
141
|
+
[
|
|
142
142
|
"Delete cancelled",
|
|
143
143
|
],
|
|
144
144
|
]
|
|
145
145
|
`);
|
|
146
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
146
|
+
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
147
147
|
});
|
|
148
148
|
|
|
149
149
|
test('should not ask for prompt if autoConfirmAction is set', async () => {
|
|
@@ -158,24 +158,24 @@ describe('delete command tests', () => {
|
|
|
158
158
|
const runResult = await DeleteCommand.run();
|
|
159
159
|
|
|
160
160
|
expect(runResult).toMatchInlineSnapshot(`
|
|
161
|
-
|
|
161
|
+
{
|
|
162
162
|
"status": "success",
|
|
163
163
|
}
|
|
164
164
|
`);
|
|
165
165
|
expect(promptConfirm).not.toHaveBeenCalled();
|
|
166
166
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
[
|
|
168
|
+
[
|
|
169
169
|
"Successfully deleted mesh %s",
|
|
170
170
|
"mesh_id",
|
|
171
171
|
],
|
|
172
|
-
|
|
172
|
+
[
|
|
173
173
|
"Successfully unsubscribed API Key %s",
|
|
174
174
|
"dummy_client_id",
|
|
175
175
|
],
|
|
176
176
|
]
|
|
177
177
|
`);
|
|
178
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
178
|
+
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
179
179
|
});
|
|
180
180
|
|
|
181
181
|
test('should fail if mesh delete fails', async () => {
|
|
@@ -189,15 +189,15 @@ describe('delete command tests', () => {
|
|
|
189
189
|
),
|
|
190
190
|
);
|
|
191
191
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
[
|
|
193
|
+
[
|
|
194
194
|
"mesh delete failed",
|
|
195
195
|
],
|
|
196
196
|
]
|
|
197
197
|
`);
|
|
198
198
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
[
|
|
200
|
+
[
|
|
201
201
|
"Unable to delete mesh. Please check the details and try again. If the error persists please contact support. RequestId: dummy_request_id",
|
|
202
202
|
],
|
|
203
203
|
]
|
|
@@ -215,19 +215,19 @@ describe('delete command tests', () => {
|
|
|
215
215
|
),
|
|
216
216
|
);
|
|
217
217
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
218
|
-
|
|
219
|
-
|
|
218
|
+
[
|
|
219
|
+
[
|
|
220
220
|
"Successfully deleted mesh %s",
|
|
221
221
|
"mesh_id",
|
|
222
222
|
],
|
|
223
|
-
|
|
223
|
+
[
|
|
224
224
|
"unable to get api key",
|
|
225
225
|
],
|
|
226
226
|
]
|
|
227
227
|
`);
|
|
228
228
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
[
|
|
230
|
+
[
|
|
231
231
|
"Unable to delete mesh. Please check the details and try again. If the error persists please contact support. RequestId: dummy_request_id",
|
|
232
232
|
],
|
|
233
233
|
]
|
|
@@ -245,19 +245,19 @@ describe('delete command tests', () => {
|
|
|
245
245
|
),
|
|
246
246
|
);
|
|
247
247
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
[
|
|
249
|
+
[
|
|
250
250
|
"Successfully deleted mesh %s",
|
|
251
251
|
"mesh_id",
|
|
252
252
|
],
|
|
253
|
-
|
|
253
|
+
[
|
|
254
254
|
"unsubscribe api failed",
|
|
255
255
|
],
|
|
256
256
|
]
|
|
257
257
|
`);
|
|
258
258
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
[
|
|
260
|
+
[
|
|
261
261
|
"Unable to delete mesh. Please check the details and try again. If the error persists please contact support. RequestId: dummy_request_id",
|
|
262
262
|
],
|
|
263
263
|
]
|
|
@@ -269,13 +269,13 @@ describe('delete command tests', () => {
|
|
|
269
269
|
|
|
270
270
|
expect(initRequestId).toHaveBeenCalled();
|
|
271
271
|
expect(runResult).toMatchInlineSnapshot(`
|
|
272
|
-
|
|
272
|
+
{
|
|
273
273
|
"status": "success",
|
|
274
274
|
}
|
|
275
275
|
`);
|
|
276
276
|
expect(deleteMesh.mock.calls).toMatchInlineSnapshot(`
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
[
|
|
278
|
+
[
|
|
279
279
|
"1234",
|
|
280
280
|
"5678",
|
|
281
281
|
"123456789",
|
|
@@ -284,8 +284,8 @@ describe('delete command tests', () => {
|
|
|
284
284
|
]
|
|
285
285
|
`);
|
|
286
286
|
expect(getApiKeyCredential.mock.calls).toMatchInlineSnapshot(`
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
[
|
|
288
|
+
[
|
|
289
289
|
"1234",
|
|
290
290
|
"5678",
|
|
291
291
|
"123456789",
|
|
@@ -293,8 +293,8 @@ describe('delete command tests', () => {
|
|
|
293
293
|
]
|
|
294
294
|
`);
|
|
295
295
|
expect(unsubscribeCredentialFromMeshService.mock.calls).toMatchInlineSnapshot(`
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
[
|
|
297
|
+
[
|
|
298
298
|
"1234",
|
|
299
299
|
"5678",
|
|
300
300
|
"123456789",
|
|
@@ -303,17 +303,17 @@ describe('delete command tests', () => {
|
|
|
303
303
|
]
|
|
304
304
|
`);
|
|
305
305
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
306
|
-
|
|
307
|
-
|
|
306
|
+
[
|
|
307
|
+
[
|
|
308
308
|
"Successfully deleted mesh %s",
|
|
309
309
|
"mesh_id",
|
|
310
310
|
],
|
|
311
|
-
|
|
311
|
+
[
|
|
312
312
|
"Successfully unsubscribed API Key %s",
|
|
313
313
|
"dummy_client_id",
|
|
314
314
|
],
|
|
315
315
|
]
|
|
316
316
|
`);
|
|
317
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
317
|
+
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
318
318
|
});
|
|
319
319
|
});
|
|
@@ -74,8 +74,8 @@ describe('describe command tests', () => {
|
|
|
74
74
|
expect(DescribeCommand.description).toMatchInlineSnapshot(`"Get details of a mesh"`);
|
|
75
75
|
expect(DescribeCommand.args).toMatchInlineSnapshot(`undefined`);
|
|
76
76
|
expect(DescribeCommand.flags).toMatchInlineSnapshot(`
|
|
77
|
-
|
|
78
|
-
"ignoreCache":
|
|
77
|
+
{
|
|
78
|
+
"ignoreCache": {
|
|
79
79
|
"allowNo": false,
|
|
80
80
|
"char": "i",
|
|
81
81
|
"default": false,
|
|
@@ -85,7 +85,7 @@ describe('describe command tests', () => {
|
|
|
85
85
|
},
|
|
86
86
|
}
|
|
87
87
|
`);
|
|
88
|
-
expect(DescribeCommand.aliases).toMatchInlineSnapshot(`
|
|
88
|
+
expect(DescribeCommand.aliases).toMatchInlineSnapshot(`[]`);
|
|
89
89
|
});
|
|
90
90
|
|
|
91
91
|
test('should error if describe api has failed', async () => {
|
|
@@ -99,8 +99,8 @@ describe('describe command tests', () => {
|
|
|
99
99
|
),
|
|
100
100
|
);
|
|
101
101
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
[
|
|
103
|
+
[
|
|
104
104
|
"Describe api failed Please check the details and try again. If the error persists please contact support. RequestId: dummy_request_id",
|
|
105
105
|
],
|
|
106
106
|
]
|
|
@@ -118,8 +118,8 @@ describe('describe command tests', () => {
|
|
|
118
118
|
),
|
|
119
119
|
);
|
|
120
120
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
[
|
|
122
|
+
[
|
|
123
123
|
"Unable to get mesh details. Please check the details and try again. If the error persists please contact support. RequestId: dummy_request_id",
|
|
124
124
|
],
|
|
125
125
|
]
|
|
@@ -128,21 +128,11 @@ describe('describe command tests', () => {
|
|
|
128
128
|
|
|
129
129
|
test('should error if mesh id is missing from describe api response', async () => {
|
|
130
130
|
describeMesh.mockResolvedValueOnce({});
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
137
|
-
Array [
|
|
138
|
-
Array [
|
|
139
|
-
"Unable to get mesh details. Please check the details and try again. RequestId: dummy_request_id",
|
|
140
|
-
Object {
|
|
141
|
-
"exit": false,
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
]
|
|
145
|
-
`);
|
|
131
|
+
await DescribeCommand.run().catch(err => {
|
|
132
|
+
expect(err.message).toContain(
|
|
133
|
+
'Unable to get mesh details. Please check the details and try again.',
|
|
134
|
+
);
|
|
135
|
+
});
|
|
146
136
|
});
|
|
147
137
|
|
|
148
138
|
test('should not fail if api key is missing from mesh details', async () => {
|
|
@@ -151,35 +141,35 @@ describe('describe command tests', () => {
|
|
|
151
141
|
const runResult = await DescribeCommand.run();
|
|
152
142
|
|
|
153
143
|
expect(runResult).toMatchInlineSnapshot(`
|
|
154
|
-
|
|
144
|
+
{
|
|
155
145
|
"meshId": "dummy_meshId",
|
|
156
146
|
}
|
|
157
147
|
`);
|
|
158
148
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
159
|
-
|
|
160
|
-
|
|
149
|
+
[
|
|
150
|
+
[
|
|
161
151
|
"Successfully retrieved mesh details
|
|
162
152
|
",
|
|
163
153
|
],
|
|
164
|
-
|
|
154
|
+
[
|
|
165
155
|
"Org ID: %s",
|
|
166
156
|
"1234",
|
|
167
157
|
],
|
|
168
|
-
|
|
158
|
+
[
|
|
169
159
|
"Project ID: %s",
|
|
170
160
|
"5678",
|
|
171
161
|
],
|
|
172
|
-
|
|
162
|
+
[
|
|
173
163
|
"Workspace ID: %s",
|
|
174
164
|
"123456789",
|
|
175
165
|
],
|
|
176
|
-
|
|
166
|
+
[
|
|
177
167
|
"Mesh ID: %s",
|
|
178
168
|
"dummy_meshId",
|
|
179
169
|
],
|
|
180
170
|
]
|
|
181
171
|
`);
|
|
182
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
172
|
+
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
183
173
|
});
|
|
184
174
|
|
|
185
175
|
test('should succeed if valid details are provided', async () => {
|
|
@@ -192,44 +182,44 @@ describe('describe command tests', () => {
|
|
|
192
182
|
selectedWorkspace.id,
|
|
193
183
|
);
|
|
194
184
|
expect(runResult).toMatchInlineSnapshot(`
|
|
195
|
-
|
|
185
|
+
{
|
|
196
186
|
"apiKey": "dummy_apiKey",
|
|
197
187
|
"meshId": "dummy_meshId",
|
|
198
188
|
}
|
|
199
189
|
`);
|
|
200
190
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
201
|
-
|
|
202
|
-
|
|
191
|
+
[
|
|
192
|
+
[
|
|
203
193
|
"Successfully retrieved mesh details
|
|
204
194
|
",
|
|
205
195
|
],
|
|
206
|
-
|
|
196
|
+
[
|
|
207
197
|
"Org ID: %s",
|
|
208
198
|
"1234",
|
|
209
199
|
],
|
|
210
|
-
|
|
200
|
+
[
|
|
211
201
|
"Project ID: %s",
|
|
212
202
|
"5678",
|
|
213
203
|
],
|
|
214
|
-
|
|
204
|
+
[
|
|
215
205
|
"Workspace ID: %s",
|
|
216
206
|
"123456789",
|
|
217
207
|
],
|
|
218
|
-
|
|
208
|
+
[
|
|
219
209
|
"Mesh ID: %s",
|
|
220
210
|
"dummy_meshId",
|
|
221
211
|
],
|
|
222
|
-
|
|
212
|
+
[
|
|
223
213
|
"API Key: %s",
|
|
224
214
|
"dummy_apiKey",
|
|
225
215
|
],
|
|
226
|
-
|
|
216
|
+
[
|
|
227
217
|
"Mesh Endpoint: %s
|
|
228
218
|
",
|
|
229
219
|
"https://graph.adobe.io/api/dummy_meshId/graphql?api_key=dummy_apiKey",
|
|
230
220
|
],
|
|
231
221
|
]
|
|
232
222
|
`);
|
|
233
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
223
|
+
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
234
224
|
});
|
|
235
225
|
});
|
|
@@ -80,15 +80,15 @@ describe('get command tests', () => {
|
|
|
80
80
|
test('snapshot get command', () => {
|
|
81
81
|
expect(GetCommand.description).toMatchInlineSnapshot(`"Get the config of a given mesh"`);
|
|
82
82
|
expect(GetCommand.args).toMatchInlineSnapshot(`
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
[
|
|
84
|
+
{
|
|
85
85
|
"name": "file",
|
|
86
86
|
},
|
|
87
87
|
]
|
|
88
88
|
`);
|
|
89
89
|
expect(GetCommand.flags).toMatchInlineSnapshot(`
|
|
90
|
-
|
|
91
|
-
"ignoreCache":
|
|
90
|
+
{
|
|
91
|
+
"ignoreCache": {
|
|
92
92
|
"allowNo": false,
|
|
93
93
|
"char": "i",
|
|
94
94
|
"default": false,
|
|
@@ -98,7 +98,7 @@ describe('get command tests', () => {
|
|
|
98
98
|
},
|
|
99
99
|
}
|
|
100
100
|
`);
|
|
101
|
-
expect(GetCommand.aliases).toMatchInlineSnapshot(`
|
|
101
|
+
expect(GetCommand.aliases).toMatchInlineSnapshot(`[]`);
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
test('should fail if mesh id is missing', async () => {
|
|
@@ -109,10 +109,10 @@ describe('get command tests', () => {
|
|
|
109
109
|
expect(err.message).toMatchInlineSnapshot(
|
|
110
110
|
`"Unable to get mesh config. No mesh found for Org(1234) -> Project(5678) -> Workspace(123456789). Please check the details and try again."`,
|
|
111
111
|
);
|
|
112
|
-
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
112
|
+
expect(logSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
113
113
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
[
|
|
115
|
+
[
|
|
116
116
|
"Unable to get mesh config. No mesh found for Org(1234) -> Project(5678) -> Workspace(123456789). Please check the details and try again.",
|
|
117
117
|
],
|
|
118
118
|
]
|
|
@@ -128,10 +128,10 @@ describe('get command tests', () => {
|
|
|
128
128
|
expect(err.message).toMatchInlineSnapshot(
|
|
129
129
|
`"Unable to get mesh ID. Please check the details and try again. RequestId: dummy_request_id"`,
|
|
130
130
|
);
|
|
131
|
-
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
131
|
+
expect(logSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
132
132
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
[
|
|
134
|
+
[
|
|
135
135
|
"Unable to get mesh ID. Please check the details and try again. RequestId: dummy_request_id",
|
|
136
136
|
],
|
|
137
137
|
]
|
|
@@ -142,20 +142,11 @@ describe('get command tests', () => {
|
|
|
142
142
|
test('should fail if mesh id is not found', async () => {
|
|
143
143
|
getMesh.mockResolvedValueOnce(null);
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
Array [
|
|
151
|
-
Array [
|
|
152
|
-
"Unable to get mesh with the ID dummy_meshId. Please check the mesh ID and try again. RequestId: dummy_request_id",
|
|
153
|
-
Object {
|
|
154
|
-
"exit": false,
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
]
|
|
158
|
-
`);
|
|
145
|
+
await GetCommand.run().catch(err => {
|
|
146
|
+
expect(err.message).toContain(
|
|
147
|
+
'Unable to get mesh with the ID dummy_meshId. Please check the mesh ID and try again.',
|
|
148
|
+
);
|
|
149
|
+
});
|
|
159
150
|
});
|
|
160
151
|
|
|
161
152
|
test('should fail if get mesh method failed', async () => {
|
|
@@ -169,15 +160,15 @@ describe('get command tests', () => {
|
|
|
169
160
|
),
|
|
170
161
|
);
|
|
171
162
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
172
|
-
|
|
173
|
-
|
|
163
|
+
[
|
|
164
|
+
[
|
|
174
165
|
"get mesh failed",
|
|
175
166
|
],
|
|
176
167
|
]
|
|
177
168
|
`);
|
|
178
169
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
179
|
-
|
|
180
|
-
|
|
170
|
+
[
|
|
171
|
+
[
|
|
181
172
|
"Unable to get mesh. Please check the details and try again. If the error persists please contact support. RequestId: dummy_request_id",
|
|
182
173
|
],
|
|
183
174
|
]
|
|
@@ -195,19 +186,19 @@ describe('get command tests', () => {
|
|
|
195
186
|
expect(initRequestId).toHaveBeenCalled();
|
|
196
187
|
expect(runResult).toEqual({ meshId: 'dummy_meshId', mesh: mockGetMeshConfig });
|
|
197
188
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
198
|
-
|
|
199
|
-
|
|
189
|
+
[
|
|
190
|
+
[
|
|
200
191
|
"Successfully retrieved mesh %s",
|
|
201
192
|
"{
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
193
|
+
"meshId": "dummy_meshId",
|
|
194
|
+
"mesh": {
|
|
195
|
+
"meshConfig": {
|
|
196
|
+
"sources": [
|
|
206
197
|
{
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
198
|
+
"name": "<api_name>",
|
|
199
|
+
"handler": {
|
|
200
|
+
"graphql": {
|
|
201
|
+
"endpoint": "<gql_endpoint>"
|
|
211
202
|
}
|
|
212
203
|
}
|
|
213
204
|
}
|
|
@@ -216,13 +207,13 @@ describe('get command tests', () => {
|
|
|
216
207
|
}
|
|
217
208
|
}",
|
|
218
209
|
],
|
|
219
|
-
|
|
210
|
+
[
|
|
220
211
|
"Successfully wrote mesh to file %s",
|
|
221
212
|
"mesh.json",
|
|
222
213
|
],
|
|
223
214
|
]
|
|
224
215
|
`);
|
|
225
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
216
|
+
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
226
217
|
});
|
|
227
218
|
|
|
228
219
|
test('should write to file if file argument is provided', async () => {
|
|
@@ -242,27 +233,27 @@ describe('get command tests', () => {
|
|
|
242
233
|
|
|
243
234
|
expect(runResult).toEqual({ meshId: 'dummy_meshId', mesh: mockGetMeshConfig });
|
|
244
235
|
expect(writeFile.mock.calls).toMatchInlineSnapshot(`
|
|
245
|
-
|
|
246
|
-
|
|
236
|
+
[
|
|
237
|
+
[
|
|
247
238
|
"./mesh.json",
|
|
248
239
|
"{}",
|
|
249
240
|
],
|
|
250
241
|
]
|
|
251
242
|
`);
|
|
252
243
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
253
|
-
|
|
254
|
-
|
|
244
|
+
[
|
|
245
|
+
[
|
|
255
246
|
"Successfully retrieved mesh %s",
|
|
256
247
|
"{
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
248
|
+
"meshId": "dummy_meshId",
|
|
249
|
+
"mesh": {
|
|
250
|
+
"meshConfig": {
|
|
251
|
+
"sources": [
|
|
261
252
|
{
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
253
|
+
"name": "<api_name>",
|
|
254
|
+
"handler": {
|
|
255
|
+
"graphql": {
|
|
256
|
+
"endpoint": "<gql_endpoint>"
|
|
266
257
|
}
|
|
267
258
|
}
|
|
268
259
|
}
|
|
@@ -271,13 +262,13 @@ describe('get command tests', () => {
|
|
|
271
262
|
}
|
|
272
263
|
}",
|
|
273
264
|
],
|
|
274
|
-
|
|
265
|
+
[
|
|
275
266
|
"Successfully wrote mesh to file %s",
|
|
276
267
|
"./mesh.json",
|
|
277
268
|
],
|
|
278
269
|
]
|
|
279
270
|
`);
|
|
280
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
271
|
+
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
281
272
|
});
|
|
282
273
|
|
|
283
274
|
test('should log error if failed to write to file', async () => {
|
|
@@ -296,27 +287,27 @@ describe('get command tests', () => {
|
|
|
296
287
|
|
|
297
288
|
expect(runResult).toEqual({ meshId: 'dummy_meshId', mesh: mockGetMeshConfig });
|
|
298
289
|
expect(writeFile.mock.calls).toMatchInlineSnapshot(`
|
|
299
|
-
|
|
300
|
-
|
|
290
|
+
[
|
|
291
|
+
[
|
|
301
292
|
"./mesh.json",
|
|
302
293
|
"{}",
|
|
303
294
|
],
|
|
304
295
|
]
|
|
305
296
|
`);
|
|
306
297
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
307
|
-
|
|
308
|
-
|
|
298
|
+
[
|
|
299
|
+
[
|
|
309
300
|
"Successfully retrieved mesh %s",
|
|
310
301
|
"{
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
302
|
+
"meshId": "dummy_meshId",
|
|
303
|
+
"mesh": {
|
|
304
|
+
"meshConfig": {
|
|
305
|
+
"sources": [
|
|
315
306
|
{
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
307
|
+
"name": "<api_name>",
|
|
308
|
+
"handler": {
|
|
309
|
+
"graphql": {
|
|
310
|
+
"endpoint": "<gql_endpoint>"
|
|
320
311
|
}
|
|
321
312
|
}
|
|
322
313
|
}
|
|
@@ -325,12 +316,12 @@ describe('get command tests', () => {
|
|
|
325
316
|
}
|
|
326
317
|
}",
|
|
327
318
|
],
|
|
328
|
-
|
|
319
|
+
[
|
|
329
320
|
"Unable to write mesh to file %s",
|
|
330
321
|
"./mesh.json",
|
|
331
322
|
],
|
|
332
323
|
]
|
|
333
324
|
`);
|
|
334
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
325
|
+
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
335
326
|
});
|
|
336
327
|
});
|