<commit_before>import { assert } from 'chai';

import { writeQueryResult } from '../src/normalize';
import { runQuery } from '../src/runFragment';

describe('roundtrip', () => {
  it('properly normalizes a real graphql result', () => {
    cacheRoundtrip(`
      {
        people_one(id: "1") {
          name
        }
      }
    `, {
      people_one: {
        name: '<NAME>',
      },
    });
  });
});

function cacheRoundtrip(query, result) {
  const store = writeQueryResult({
    result,
    query,
  });

  const reconstructedResult = runQuery({
    store,
    query,
  });

  assert.deepEqual(result, reconstructedResult);
}<commit_msg>Use the word store<commit_after>import { assert } from 'chai';

import { writeQueryResult } from '../src/normalize';
import { runQuery } from '../src/runFragment';

describe('roundtrip', () => {
  it('properly normalizes a real graphql result', () => {
    storeRoundtrip(`
      {
        people_one(id: "1") {
          name
        }
      }
    `, {
      people_one: {
        name: '<NAME>',
      },
    });
  });
});

function storeRoundtrip(query, result) {
  const store = writeQueryResult({
    result,
    query,
  });

  const reconstructedResult = runQuery({
    store,
    query,
  });

  assert.deepEqual(result, reconstructedResult);
}
{'fraction_non_alphanumeric': 0.1585835257890685, 'fraction_numerical': 0.001539645881447267, 'mean_word_length': 2.5135135135135136, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5129217', 'n_tokens_mistral': 422, 'n_tokens_neox': 398, 'n_words': 85}