<commit_before>var _ = require('underscore');
var L = require('leaflet');

var SharedTestsForCartoDBLayerGroupViews = require('../shared-tests-for-cartodb-layer-group-views');
var FakeWax = require('../fake-wax');

var OriginalLeafletCartoDBLayerGroupView = require('../../../../src/geo/leaflet/leaflet-cartodb-layer-group-view');

var LeafletCartoDBLayerGroupView = OriginalLeafletCartoDBLayerGroupView;

LeafletCartoDBLayerGroupView.prototype = _.extend(
  {},
  OriginalLeafletCartoDBLayerGroupView.prototype,
  {
    interactionClass: FakeWax
  }
);

var expectTileURLTemplateToMatch = function (layerGroupView, expectedTileURLTemplate) {
  expect(layerGroupView.leafletLayer._url).toEqual(expectedTileURLTemplate);
};

var createLayerGroupView = function (layerGroupModel, container) {
  var leafletMap = new L.Map(container, {
    center: [0, 0],
    zoom: 3
  });

  var mapModel = {
    addErrorTile: function () {}
  };

  var layerGroupView = new LeafletCartoDBLayerGroupView(layerGroupModel, leafletMap, mapModel);
  layerGroupView.leafletLayer.addTo(leafletMap);
  return layerGroupView;
};

var fireNativeEvent = function (layerGroupView, eventName) {
  layerGroupView.leafletLayer.fire(eventName);
};

describe('src/geo/leaflet/leaflet-cartodb-layer-group-view.js', function () {
  SharedTestsForCartoDBLayerGroupViews.call(this, createLayerGroupView, expectTileURLTemplateToMatch, fireNativeEvent);
});
<commit_msg>Use backbone model instead of plain object in test<commit_after>var Backbone = require('backbone');
var _ = require('underscore');
var L = require('leaflet');

var SharedTestsForCartoDBLayerGroupViews = require('../shared-tests-for-cartodb-layer-group-views');
var FakeWax = require('../fake-wax');

var OriginalLeafletCartoDBLayerGroupView = require('../../../../src/geo/leaflet/leaflet-cartodb-layer-group-view');

var LeafletCartoDBLayerGroupView = OriginalLeafletCartoDBLayerGroupView;

LeafletCartoDBLayerGroupView.prototype = _.extend(
  {},
  OriginalLeafletCartoDBLayerGroupView.prototype,
  {
    interactionClass: FakeWax
  }
);

var expectTileURLTemplateToMatch = function (layerGroupView, expectedTileURLTemplate) {
  expect(layerGroupView.leafletLayer._url).toEqual(expectedTileURLTemplate);
};

var createLayerGroupView = function (layerGroupModel, container) {
  var leafletMap = new L.Map(container, {
    center: [0, 0],
    zoom: 3
  });

  var mapModel = new Backbone.Model();

  var layerGroupView = new LeafletCartoDBLayerGroupView(layerGroupModel, leafletMap, mapModel);
  layerGroupView.leafletLayer.addTo(leafletMap);
  return layerGroupView;
};

var fireNativeEvent = function (layerGroupView, eventName) {
  layerGroupView.leafletLayer.fire(eventName);
};

describe('src/geo/leaflet/leaflet-cartodb-layer-group-view.js', function () {
  SharedTestsForCartoDBLayerGroupViews.call(this, createLayerGroupView, expectTileURLTemplateToMatch, fireNativeEvent);
});

{'fraction_non_alphanumeric': 0.12075471698113208, 'fraction_numerical': 0.002058319039451115, 'mean_word_length': 6.009615384615385, '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': '4822800', 'n_tokens_mistral': 933, 'n_tokens_neox': 925, 'n_words': 145}