<commit_before>'use strict';

var Immutable = require('immutable');
var assert = require('assert');
var patch = require('../src/patch');

describe('Map patch', function () {
  it('returns same Map when ops are empty', function () {
    var map = Immutable.Map({a: 1, b:2});
    var ops = Immutable.List();

    var result = patch(map, ops);

    assert.ok(Immutable.is(map, result));
  });

  it('adds missing values in ops', function () {
    var map = Immutable.Map();
    var ops = Immutable.fromJS([
      {op: 'add', path: '/a', value: 1}
    ]);

    var result = patch(map, ops);
    var expected = Immutable.Map({a: 1});

    assert.ok(Immutable.is(result, expected));
  });
});<commit_msg>testing Map replace ops<commit_after>'use strict';

var Immutable = require('immutable');
var assert = require('assert');
var patch = require('../src/patch');

describe('Map patch', function () {
  it('returns same Map when ops are empty', function () {
    var map = Immutable.Map({a: 1, b:2});
    var ops = Immutable.List();

    var result = patch(map, ops);

    assert.ok(Immutable.is(map, result));
  });

  it('adds missing value in empty map', function () {
    var map = Immutable.Map();
    var ops = Immutable.fromJS([
      {op: 'add', path: '/a', value: 1}
    ]);

    var result = patch(map, ops);
    var expected = Immutable.Map({a: 1});

    assert.ok(Immutable.is(result, expected));
  });

  it('adds missing value in map', function () {
    var map = Immutable.Map({a: 1});
    var ops = Immutable.fromJS([
      {op: 'add', path: '/b', value: 2}
    ]);

    var result = patch(map, ops);
    var expected = Immutable.Map({a: 1, b: 2});

    assert.ok(Immutable.is(result, expected));
  });

  it('replaces value in map', function () {
    var map = Immutable.Map({a: 1, b: 1});
    var ops = Immutable.fromJS([
      {op: 'replace', path: '/b', value: 2}
    ]);

    var result = patch(map, ops);
    var expected = Immutable.Map({a: 1, b: 2});

    assert.ok(Immutable.is(result, expected));
  });
});
{'fraction_non_alphanumeric': 0.18962962962962962, 'fraction_numerical': 0.008395061728395062, 'mean_word_length': 3.168724279835391, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2062310', 'n_tokens_mistral': 700, 'n_tokens_neox': 667, 'n_words': 195}