<commit_before>const test = require('tape');
const strip = require('strip-ansi');
const flamongo = require('./lib/tester');

const schema = {
    name: {
      first: 'first',
      last: 'last',
    },
    vegan: 'bool',
    happy: {
      _type: 'bool',
      args: { likelihood: 10 },
    },
    birthday: 'date',
    jobTitle: {
      _type: 'enum',
      options: ['software developer', 'football player'],
    },
    friends: [{
      name: {
        first: 'first',
        last: 'last',
      },
    }],
  };

test('check performance of provided indexes', function (t) {
  t.plan(1);

  const indexKeys = [
    { 'name.last': 1 },
    { 'name.last': 1, vegan: 1 },
    { 'name.first': 1, vegan: 1 },
  ];

  const queries = [
    { 'name.first': 'Richard' },
    { 'name.first': 'John', vegan: false, 'name.last': { $nin: ['Smith'] } }
  ];

  flamongo(indexKeys, queries, schema, { verbose: false, preserveData: false })
    .then((queryResults) => {
      const indexUseRegex = /.*Examined [\d]+ keys on index name.first_1_vegan_1 in a forward direction.*/;
      t.ok(indexUseRegex.test(strip(queryResults[1].output)));
      t.end();
    });
});

test('check performance of all possible indexes', function (t) {
  t.plan(2);

  const queries = [
    { 'name.first': 'Richard', vegan: false },
  ];

  flamongo([], queries, schema, { verbose: false, preserveData: false, bestIndex: true })
    .then((indexResults) => {
      t.ok(indexResults[0].id);
      t.ok(indexResults[0].time || indexResults[0].time === 0);
      t.end();
    })
    .catch((error) => { throw error });
});<commit_msg>remove pointless args from test execution<commit_after>const test = require('tape');
const strip = require('strip-ansi');
const flamongo = require('./lib/tester');

const schema = {
    name: {
      first: 'first',
      last: 'last',
    },
    vegan: 'bool',
    happy: {
      _type: 'bool',
      args: { likelihood: 10 },
    },
    birthday: 'date',
    jobTitle: {
      _type: 'enum',
      options: ['software developer', 'football player'],
    },
    friends: [{
      name: {
        first: 'first',
        last: 'last',
      },
    }],
  };

test('check performance of provided indexes', function (t) {
  t.plan(1);

  const indexKeys = [
    { 'name.last': 1 },
    { 'name.last': 1, vegan: 1 },
    { 'name.first': 1, vegan: 1 },
  ];

  const queries = [
    { 'name.first': 'Richard' },
    { 'name.first': 'John', vegan: false, 'name.last': { $nin: ['Smith'] } }
  ];

  flamongo(indexKeys, queries, schema, { verbose: false, preserveData: false })
    .then((queryResults) => {
      const indexUseRegex = /.*Examined [\d]+ keys on index name.first_1_vegan_1 in a forward direction.*/;
      t.ok(indexUseRegex.test(strip(queryResults[1].output)));
      t.end();
    });
});

test('check performance of all possible indexes', function (t) {
  t.plan(2);

  const queries = [
    { 'name.first': 'Richard', vegan: false },
  ];

  flamongo([], queries, schema, { bestIndex: true })
    .then((indexResults) => {
      t.ok(indexResults[0].id);
      t.ok(indexResults[0].time || indexResults[0].time === 0);
      t.end();
    })
    .catch((error) => { throw error });
});
{'fraction_non_alphanumeric': 0.1944357611753673, 'fraction_numerical': 0.01000312597686777, 'mean_word_length': 2.695150115473441, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6040397', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1066, 'n_words': 253}