How to use the @cumulus/common/test-utils.inTestMode function in @cumulus/common

To help you get started, we’ve selected a few @cumulus/common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nasa / cumulus / packages / api / es / indexer.js View on Github external
async function genericRecordUpdate(esClient, id, doc, index, type, parent) {
  if (!doc) throw new Error('Nothing to update. Make sure doc argument has a value');

  const body = cloneDeep(doc);
  body.timestamp = Date.now();

  const params = {
    body,
    id,
    index,
    type,
    refresh: inTestMode()
  };

  if (parent) params.parent = parent;

  // adding or replacing record to ES
  const actualEsClient = esClient || (await Search.es());
  return actualEsClient.index(params);
}
github nasa / cumulus / packages / api / es / indexer.js View on Github external
async function genericRecordUpdate(esClient, id, doc, index, type, parent) {
  if (!esClient) {
    esClient = await Search.es();
  }

  if (!doc) {
    throw new Error('Nothing to update. Make sure doc argument has a value');
  }

  doc.timestamp = Date.now();

  const params = {
    index,
    type,
    id,
    refresh: inTestMode(),
    body: doc
  };

  if (parent) {
    params.parent = parent;
  }

  // adding or replacing record to ES
  return esClient.index(params);
}
github nasa / cumulus / packages / api / models / base.js View on Github external
if (range) {
    params.KeySchema.push({
      AttributeName: range.name,
      KeyType: 'RANGE'
    });

    params.AttributeDefinitions.push({
      AttributeName: range.name,
      AttributeType: range.type
    });
  }

  const output = await aws.dynamodb().createTable(params).promise();
  await aws.dynamodb().waitFor('tableExists', { TableName: tableName }).promise();

  if (!inTestMode()) await enableStream(tableName);

  return output;
}