1
1
import { endpoint } from '..' ;
2
2
3
- import type { MirroredRequest } from '../../../__mocks__/handlers' ;
3
+ import { mirror } from '../../../__mocks__/handlers' ;
4
4
5
5
const GCS_HOST = 'https://fa5e.bd7c.data.globus.org' ;
6
6
7
7
describe ( 'gcs – endpoint' , ( ) => {
8
8
test ( 'get' , async ( ) => {
9
- const result = await endpoint . get ( {
10
- host : GCS_HOST ,
11
- endpoint_id : 'ac9cb54b-fc48-4824-b801-1388baf0a909' ,
12
- } ) ;
13
9
const {
14
10
req : { url, method, headers } ,
15
- } = ( await result . json ( ) ) as unknown as MirroredRequest ;
11
+ } = await mirror (
12
+ await endpoint . get ( {
13
+ host : GCS_HOST ,
14
+ endpoint_id : 'ac9cb54b-fc48-4824-b801-1388baf0a909' ,
15
+ } ) ,
16
+ ) ;
16
17
expect ( {
17
18
url,
18
19
method,
@@ -33,21 +34,24 @@ describe('gcs – endpoint', () => {
33
34
} ) ;
34
35
35
36
test ( 'update' , async ( ) => {
36
- const result = await endpoint . update (
37
- {
38
- host : GCS_HOST ,
39
- endpoint_id : 'ac9cb54b-fc48-4824-b801-1388baf0a909' ,
40
- } ,
41
- {
42
- payload : {
43
- DATA_TYPE : 'endpoint#1.0.0' ,
44
- display_name : 'My First Endpoint' ,
45
- } ,
46
- } ,
47
- ) ;
48
37
const {
49
38
req : { url, method, headers, json } ,
50
- } = ( await result . json ( ) ) as unknown as MirroredRequest ;
39
+ } = await mirror (
40
+ await endpoint . update (
41
+ {
42
+ host : GCS_HOST ,
43
+ endpoint_id : 'ac9cb54b-fc48-4824-b801-1388baf0a909' ,
44
+ } ,
45
+ {
46
+ payload : {
47
+ DATA_TYPE : 'endpoint#1.0.0' ,
48
+ display_name : 'My First Endpoint' ,
49
+ network_use : 'normal' ,
50
+ public : true ,
51
+ } ,
52
+ } ,
53
+ ) ,
54
+ ) ;
51
55
expect ( {
52
56
url,
53
57
method,
@@ -59,14 +63,16 @@ describe('gcs – endpoint', () => {
59
63
"accept": "*/*",
60
64
"accept-encoding": "gzip,deflate",
61
65
"connection": "close",
62
- "content-length": "65 ",
66
+ "content-length": "102 ",
63
67
"content-type": "application/json",
64
68
"host": "fa5e.bd7c.data.globus.org",
65
69
"user-agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
66
70
},
67
71
"json": {
68
72
"DATA_TYPE": "endpoint#1.0.0",
69
73
"display_name": "My First Endpoint",
74
+ "network_use": "normal",
75
+ "public": true,
70
76
},
71
77
"method": "PUT",
72
78
"url": "https://fa5e.bd7c.data.globus.org/api/endpoint",
@@ -75,20 +81,21 @@ describe('gcs – endpoint', () => {
75
81
} ) ;
76
82
77
83
test ( 'patch' , async ( ) => {
78
- const result = await endpoint . patch (
79
- {
80
- host : GCS_HOST ,
81
- endpoint_id : 'ac9cb54b-fc48-4824-b801-1388baf0a909' ,
82
- } ,
83
- {
84
- payload : {
85
- public : true ,
86
- } ,
87
- } ,
88
- ) ;
89
84
const {
90
85
req : { url, method, headers, json } ,
91
- } = ( await result . json ( ) ) as unknown as MirroredRequest ;
86
+ } = await mirror (
87
+ await endpoint . patch (
88
+ {
89
+ host : GCS_HOST ,
90
+ endpoint_id : 'ac9cb54b-fc48-4824-b801-1388baf0a909' ,
91
+ } ,
92
+ {
93
+ payload : {
94
+ public : true ,
95
+ } ,
96
+ } ,
97
+ ) ,
98
+ ) ;
92
99
expect ( {
93
100
url,
94
101
method,
@@ -115,21 +122,22 @@ describe('gcs – endpoint', () => {
115
122
} ) ;
116
123
117
124
test ( 'updateSubscriptionId' , async ( ) => {
118
- const result = await endpoint . updateSubscriptionId (
119
- {
120
- host : GCS_HOST ,
121
- endpoint_id : 'ac9cb54b-fc48-4824-b801-1388baf0a909' ,
122
- } ,
123
- {
124
- payload : {
125
- DATA_TYPE : 'endpoint_subscription#1.0.0' ,
126
- subscription_id : 'example-subscription-id' ,
127
- } ,
128
- } ,
129
- ) ;
130
125
const {
131
126
req : { url, method, headers, json } ,
132
- } = ( await result . json ( ) ) as unknown as MirroredRequest ;
127
+ } = await mirror (
128
+ await endpoint . updateSubscriptionId (
129
+ {
130
+ host : GCS_HOST ,
131
+ endpoint_id : 'ac9cb54b-fc48-4824-b801-1388baf0a909' ,
132
+ } ,
133
+ {
134
+ payload : {
135
+ DATA_TYPE : 'endpoint_subscription#1.0.0' ,
136
+ subscription_id : 'example-subscription-id' ,
137
+ } ,
138
+ } ,
139
+ ) ,
140
+ ) ;
133
141
expect ( {
134
142
url,
135
143
method,
@@ -157,21 +165,22 @@ describe('gcs – endpoint', () => {
157
165
} ) ;
158
166
159
167
test ( 'updateOwnerString' , async ( ) => {
160
- const result = await endpoint . updateOwnerString (
161
- {
162
- host : GCS_HOST ,
163
- endpoint_id : 'ac9cb54b-fc48-4824-b801-1388baf0a909' ,
164
- } ,
165
- {
166
- payload : {
167
- DATA_TYPE : 'owner_string#1.0.0' ,
168
- identity_id : 'example-identity-id' ,
169
- } ,
170
- } ,
171
- ) ;
172
168
const {
173
169
req : { url, method, headers, json } ,
174
- } = ( await result . json ( ) ) as unknown as MirroredRequest ;
170
+ } = await mirror (
171
+ await endpoint . updateOwnerString (
172
+ {
173
+ host : GCS_HOST ,
174
+ endpoint_id : 'ac9cb54b-fc48-4824-b801-1388baf0a909' ,
175
+ } ,
176
+ {
177
+ payload : {
178
+ DATA_TYPE : 'owner_string#1.0.0' ,
179
+ identity_id : 'example-identity-id' ,
180
+ } ,
181
+ } ,
182
+ ) ,
183
+ ) ;
175
184
expect ( {
176
185
url,
177
186
method,
@@ -199,21 +208,22 @@ describe('gcs – endpoint', () => {
199
208
} ) ;
200
209
201
210
test ( 'updateOwner' , async ( ) => {
202
- const result = await endpoint . updateOwner (
203
- {
204
- host : GCS_HOST ,
205
- endpoint_id : 'ac9cb54b-fc48-4824-b801-1388baf0a909' ,
206
- } ,
207
- {
208
- payload : {
209
- DATA_TYPE : 'endpoint_owner#1.0.0' ,
210
- identity_id : 'example-identity-id' ,
211
- } ,
212
- } ,
213
- ) ;
214
211
const {
215
212
req : { url, method, headers, json } ,
216
- } = ( await result . json ( ) ) as unknown as MirroredRequest ;
213
+ } = await mirror (
214
+ await endpoint . updateOwner (
215
+ {
216
+ host : GCS_HOST ,
217
+ endpoint_id : 'ac9cb54b-fc48-4824-b801-1388baf0a909' ,
218
+ } ,
219
+ {
220
+ payload : {
221
+ DATA_TYPE : 'endpoint_owner#1.0.0' ,
222
+ identity_id : 'example-identity-id' ,
223
+ } ,
224
+ } ,
225
+ ) ,
226
+ ) ;
217
227
expect ( {
218
228
url,
219
229
method,
@@ -241,16 +251,17 @@ describe('gcs – endpoint', () => {
241
251
} ) ;
242
252
243
253
test ( 'resetOwnerString' , async ( ) => {
244
- const result = await endpoint . resetOwnerString (
245
- {
246
- host : GCS_HOST ,
247
- endpoint_id : 'ac9cb54b-fc48-4824-b801-1388baf0a909' ,
248
- } ,
249
- { } ,
250
- ) ;
251
254
const {
252
255
req : { url, method, headers } ,
253
- } = ( await result . json ( ) ) as unknown as MirroredRequest ;
256
+ } = await mirror (
257
+ await endpoint . resetOwnerString (
258
+ {
259
+ host : GCS_HOST ,
260
+ endpoint_id : 'ac9cb54b-fc48-4824-b801-1388baf0a909' ,
261
+ } ,
262
+ { } ,
263
+ ) ,
264
+ ) ;
254
265
expect ( {
255
266
url,
256
267
method,
0 commit comments