<commit_before>import test from 'tape-catch';
import { inferAll } from '..';

test('inferAll()', t => {
  t.deepEqual(inferAll([{'a.b': 1}]), {'a.b': 'integer'}, 'should work on fields with nested dots');
  t.deepEqual(inferAll([{'a': {'b': 1}}]), {'a': 'string'}, 'should only accept top-level fields');

  t.end();
});
<commit_msg>Add more testing to ensure function is equivalent to prior code<commit_after>import test from 'tape-catch';
import { inferAll } from '..';
import { read } from 'datalib';

test('inferAll()', t => {
  t.deepEqual(inferAll([{'a.b': 1}]), {'a.b': 'integer'}, 'should work on fields with nested dots');
  t.deepEqual(inferAll([{'a': {'b': 1}}]), {'a': 'string'}, 'should only accept top-level fields');

  let testData = [{a: 1, b: 'foo', c: 1.5}];
  read(testData, {parse: 'auto'});
  t.deepEqual(testData.__types__, inferAll(testData), 'should work identically to datalib read() when no nested dots');

  t.end();
});

{'fraction_non_alphanumeric': 0.2244467860906217, 'fraction_numerical': 0.007376185458377239, 'mean_word_length': 4.9748427672955975, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4096425', 'n_tokens_mistral': 343, 'n_tokens_neox': 323, 'n_words': 99}