<commit_before>import test from 'ava';
import { brandSafeString, contains, copySafeness, entries } from '../runtime';

test('entries should split non-iterables into iterables', t => {
  const hash = { one: 1, two: 2 };
  t.deepEqual(entries(hash), [ [ 'one', 1 ], [ 'two', 2] ]);
  t.deepEqual(entries(null), []);
  t.deepEqual(entries('foo'), 'foo');
});

test('contains should test inclusion', t => {
  t.false(contains('foo', 'bar'));
  t.true(contains('12345', '123'));
  t.false(contains([ 1, 2, 3 ], 4));
  t.true(contains([ 1, 2, 3 ], 2));
  t.true(contains(new Map([ [ 'foo', 'bar' ]]), 'foo'));
  t.true(contains(new Set([ 'foo', 'bar' ]), 'foo'));
  t.true(contains({ hi: 'bye' }, 'hi'));
  t.throws(() => contains(1, 2));
});

test('copySafeness should copy safeness from one string to another', async t => {
  const one = 'one';
  const two = 'two';
  const bone = brandSafeString(one);
  const btwo = brandSafeString(two);
  t.is(copySafeness(one, two), two);
  t.is(copySafeness(bone, btwo), btwo);
  t.is(copySafeness(one, btwo), two);
  t.is(copySafeness(bone, two).__superjucks__escaped__, true);
});<commit_msg>fix(runtime): typo in test file.<commit_after>import test from 'ava';
import { brandSafeString, contains, copySafeness, entries } from '../runtime';

test('entries should split non-iterables into iterables', t => {
  const hash = { one: 1, two: 2 };
  t.deepEqual(entries(hash), [ [ 'one', 1 ], [ 'two', 2] ]);
  t.deepEqual(entries(null), []);
  t.deepEqual(entries('foo'), 'foo');
});

test('contains should test inclusion', t => {
  t.false(contains('foo', 'bar'));
  t.true(contains('12345', '123'));
  t.false(contains([ 1, 2, 3 ], 4));
  t.true(contains([ 1, 2, 3 ], 2));
  t.true(contains(new Map([ [ 'foo', 'bar' ]]), 'foo'));
  t.true(contains(new Set([ 'foo', 'bar' ]), 'foo'));
  t.true(contains({ hi: 'bye' }, 'hi'));
  t.throws(() => contains(1, 2));
});

test('copySafeness should copy safeness from one string to another', async t => {
  const one = 'one';
  const two = 'two';
  const bone = brandSafeString(one);
  const btwo = brandSafeString(two);
  t.is(copySafeness(one, two), two);
  t.is(copySafeness(bone, btwo), btwo);
  t.is(copySafeness(one, btwo), two);
  t.is(copySafeness(bone, two).__superjucks_escaped__, true);
});
{'fraction_non_alphanumeric': 0.22231985940246046, 'fraction_numerical': 0.019332161687170474, 'mean_word_length': 4.721105527638191, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '7480079', 'n_tokens_mistral': 869, 'n_tokens_neox': 828, 'n_words': 210}