@cumulus/integration-tests 21.1.0 → 21.3.1-alpha.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/.babelrc CHANGED
@@ -5,7 +5,7 @@
5
5
  "presets": [
6
6
  ["@babel/preset-env", {
7
7
  "targets": {
8
- "node": "20.12.2"
8
+ "node": "22.21.1"
9
9
  }
10
10
  }]
11
11
  ],
package/.nycrc.json CHANGED
@@ -10,4 +10,4 @@
10
10
  "functions": 62.0,
11
11
  "statements": 57.0,
12
12
  "branches": 38.0
13
- }
13
+ }
package/README.md CHANGED
@@ -40,7 +40,7 @@ $ npm install @cumulus/integration-tests
40
40
  <a name="module_Collections"></a>
41
41
 
42
42
  ## Collections
43
- **Example**
43
+ **Example**
44
44
  ```js
45
45
  const Collections = require('@cumulus/integration-test/Collections');
46
46
  ```
@@ -81,8 +81,8 @@ have a granuleId of `gran-1`. Filenames can only contain a single `.` character.
81
81
  ]
82
82
  ```
83
83
 
84
- **Kind**: Exported function
85
- **Returns**: <code>Promise.&lt;Object&gt;</code> - the generated collection
84
+ **Kind**: Exported function
85
+ **Returns**: <code>Promise.&lt;Object&gt;</code> - the generated collection
86
86
 
87
87
  | Param | Type | Description |
88
88
  | --- | --- | --- |
@@ -95,8 +95,8 @@ have a granuleId of `gran-1`. Filenames can only contain a single `.` character.
95
95
  Given a Cumulus collection configuration, return a list of the filetype
96
96
  configs with their `url_path`s updated.
97
97
 
98
- **Kind**: inner method of [<code>createCollection</code>](#exp_module_Collections--createCollection)
99
- **Returns**: <code>Array.&lt;Object&gt;</code> - a list of collection filetype configs
98
+ **Kind**: inner method of [<code>createCollection</code>](#exp_module_Collections--createCollection)
99
+ **Returns**: <code>Array.&lt;Object&gt;</code> - a list of collection filetype configs
100
100
 
101
101
  | Param | Type | Description |
102
102
  | --- | --- | --- |
@@ -109,8 +109,8 @@ configs with their `url_path`s updated.
109
109
  Update a collection with a custom file path, duplicate handling, and name
110
110
  updated with the postfix.
111
111
 
112
- **Kind**: inner method of [<code>createCollection</code>](#exp_module_Collections--createCollection)
113
- **Returns**: <code>Object</code> - an updated collection
112
+ **Kind**: inner method of [<code>createCollection</code>](#exp_module_Collections--createCollection)
113
+ **Returns**: <code>Object</code> - an updated collection
114
114
 
115
115
  | Param | Type | Description |
116
116
  | --- | --- | --- |
@@ -125,7 +125,7 @@ updated with the postfix.
125
125
  #### createCollection~collectionExists(stackName, collection) ⇒ <code>boolean</code>
126
126
  Returns true if collection exists. False otherwise.
127
127
 
128
- **Kind**: inner method of [<code>createCollection</code>](#exp_module_Collections--createCollection)
128
+ **Kind**: inner method of [<code>createCollection</code>](#exp_module_Collections--createCollection)
129
129
 
130
130
  | Param | Type | Description |
131
131
  | --- | --- | --- |
@@ -137,7 +137,7 @@ Returns true if collection exists. False otherwise.
137
137
  #### createCollection~addCollection(stackName, collection) ⇒ <code>Promise.&lt;undefined&gt;</code>
138
138
  Add a new collection to Cumulus
139
139
 
140
- **Kind**: inner method of [<code>createCollection</code>](#exp_module_Collections--createCollection)
140
+ **Kind**: inner method of [<code>createCollection</code>](#exp_module_Collections--createCollection)
141
141
 
142
142
  | Param | Type | Description |
143
143
  | --- | --- | --- |
@@ -149,8 +149,8 @@ Add a new collection to Cumulus
149
149
  #### createCollection~addCollections(stackName, bucketName, dataDirectory, [postfix], [customFilePath], [duplicateHandling]) ⇒ <code>Promise.&lt;Array.&lt;Object&gt;&gt;</code>
150
150
  Add collections to database
151
151
 
152
- **Kind**: inner method of [<code>createCollection</code>](#exp_module_Collections--createCollection)
153
- **Returns**: <code>Promise.&lt;Array.&lt;Object&gt;&gt;</code> - - collections that were added
152
+ **Kind**: inner method of [<code>createCollection</code>](#exp_module_Collections--createCollection)
153
+ **Returns**: <code>Promise.&lt;Array.&lt;Object&gt;&gt;</code> - - collections that were added
154
154
 
155
155
  | Param | Type | Description |
156
156
  | --- | --- | --- |
@@ -164,7 +164,7 @@ Add collections to database
164
164
  <a name="module_Executions"></a>
165
165
 
166
166
  ## Executions
167
- **Example**
167
+ **Example**
168
168
  ```js
169
169
  const Executions = require('@cumulus/integration-test/Executions');
170
170
  ```
@@ -178,8 +178,8 @@ const Executions = require('@cumulus/integration-test/Executions');
178
178
  ### findExecutionArn(prefix, matcher, [queryParameters], [options]) ⇒ <code>Promise.&lt;string&gt;</code> ⏏
179
179
  Find the execution ARN matching the `matcher` function
180
180
 
181
- **Kind**: Exported function
182
- **Returns**: <code>Promise.&lt;string&gt;</code> - the ARN of the matching execution
181
+ **Kind**: Exported function
182
+ **Returns**: <code>Promise.&lt;string&gt;</code> - the ARN of the matching execution
183
183
 
184
184
  | Param | Type | Default | Description |
185
185
  | --- | --- | --- | --- |
@@ -194,9 +194,9 @@ Find the execution ARN matching the `matcher` function
194
194
  ### getExecutionWithStatus(params) ⇒ <code>Promise.&lt;Object&gt;</code> ⏏
195
195
  Wait for an execution to have an expected status and return the execution
196
196
 
197
- **Kind**: Exported function
197
+ **Kind**: Exported function
198
198
  **Returns**: <code>Promise.&lt;Object&gt;</code> - the execution as returned by the `GET /executions/<execution-arn>`
199
- endpoint
199
+ endpoint
200
200
 
201
201
  | Param | Type | Default | Description |
202
202
  | --- | --- | --- | --- |
@@ -210,7 +210,7 @@ endpoint
210
210
  <a name="module_Granules"></a>
211
211
 
212
212
  ## Granules
213
- **Example**
213
+ **Example**
214
214
  ```js
215
215
  const Granules = require('@cumulus/integration-test/Granules');
216
216
  ```
@@ -224,8 +224,8 @@ const Granules = require('@cumulus/integration-test/Granules');
224
224
  ### getGranuleWithStatus(params) ⇒ <code>Promise.&lt;Object&gt;</code> ⏏
225
225
  Wait for a granule to have an expected status and return the granule
226
226
 
227
- **Kind**: Exported function
228
- **Returns**: <code>Promise.&lt;Object&gt;</code> - the granule as returned by the `GET /granules/<granule-id>` endpoint
227
+ **Kind**: Exported function
228
+ **Returns**: <code>Promise.&lt;Object&gt;</code> - the granule as returned by the `GET /granules/<granule-id>` endpoint
229
229
 
230
230
  | Param | Type | Default | Description |
231
231
  | --- | --- | --- | --- |
@@ -244,8 +244,8 @@ Wait for a granule to have an expected status and return the granule
244
244
  Wait for listGranules to return at least a single value before returning an
245
245
  empty result
246
246
 
247
- **Kind**: inner method of [<code>getGranuleWithStatus</code>](#exp_module_Granules--getGranuleWithStatus)
248
- **Returns**: <code>Promise.&lt;Object&gt;</code> - - results of a successful listGranules
247
+ **Kind**: inner method of [<code>getGranuleWithStatus</code>](#exp_module_Granules--getGranuleWithStatus)
248
+ **Returns**: <code>Promise.&lt;Object&gt;</code> - - results of a successful listGranules
249
249
 
250
250
  | Param | Type | Description |
251
251
  | --- | --- | --- |
@@ -254,7 +254,7 @@ empty result
254
254
  <a name="module_Providers"></a>
255
255
 
256
256
  ## Providers
257
- **Example**
257
+ **Example**
258
258
  ```js
259
259
  const Providers = require('@cumulus/integration-test/Providers');
260
260
  ```
@@ -269,8 +269,8 @@ Create a provider using the Cumulus API
269
269
  - **protocol**: `s3`
270
270
  - **globalConnectionLimit**: `10`
271
271
 
272
- **Kind**: Exported function
273
- **Returns**: <code>Promise.&lt;Object&gt;</code> - the generated provider
272
+ **Kind**: Exported function
273
+ **Returns**: <code>Promise.&lt;Object&gt;</code> - the generated provider
274
274
 
275
275
  | Param | Type | Description |
276
276
  | --- | --- | --- |
@@ -280,7 +280,7 @@ Create a provider using the Cumulus API
280
280
  <a name="module_Rules"></a>
281
281
 
282
282
  ## Rules
283
- **Example**
283
+ **Example**
284
284
  ```js
285
285
  const Rules = require('@cumulus/integration-test/Rules');
286
286
  ```
@@ -294,8 +294,8 @@ Create a `onetime` rule using the Cumulus API
294
294
  - **name**: random string starting with `rule_`
295
295
  - **rule**: `{ type: 'onetime' }`
296
296
 
297
- **Kind**: Exported function
298
- **Returns**: <code>Promise.&lt;Object&gt;</code> - the generated rule
297
+ **Kind**: Exported function
298
+ **Returns**: <code>Promise.&lt;Object&gt;</code> - the generated rule
299
299
 
300
300
  | Param | Type | Description |
301
301
  | --- | --- | --- |
package/cmr.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const got = require('got');
4
4
  const pWaitFor = require('p-wait-for');
5
- const xml2js = require('xml2js');
5
+ const js2xmlParser = require('js2xmlparser');
6
6
  const { s3 } = require('@cumulus/aws-client/services');
7
7
  const { buildS3Uri } = require('@cumulus/aws-client/S3');
8
8
  const { sleep } = require('@cumulus/common');
@@ -204,6 +204,11 @@ function generateCmrXml(granule, collection, additionalUrls,
204
204
  url.OnlineAccessURL.URL = url.OnlineAccessURL.URL.replace(oldGranuleId, replacementId);
205
205
  });
206
206
 
207
+ xmlObject.Granule.DataGranule = new Map();
208
+ xmlObject.Granule.DataGranule.set('SizeMBDataGranule', '10');
209
+ xmlObject.Granule.DataGranule.set('DayNightFlag', 'BOTH');
210
+ xmlObject.Granule.DataGranule.set('ProductionDateTime', '2018-07-19T12:01:01Z');
211
+
207
212
  if (additionalUrls) {
208
213
  xmlObject.Granule.OnlineAccessURLs = additionalUrls.map((url) => ({
209
214
  OnlineAccessURL: {
@@ -212,8 +217,12 @@ function generateCmrXml(granule, collection, additionalUrls,
212
217
  },
213
218
  }));
214
219
  }
220
+ const granuleMap = new Map();
221
+ Object.keys(xmlObject.Granule).forEach((key) => {
222
+ granuleMap.set(key, xmlObject.Granule[key]);
223
+ });
215
224
 
216
- const xml = new xml2js.Builder().buildObject(xmlObject);
225
+ const xml = js2xmlParser.parse('Granule', granuleMap);
217
226
  return xml;
218
227
  }
219
228