{"size": 2128, "ext": "js", "max_stars_repo_path": "spec/DynamicMapLayerAdvancedSpec.js", "max_stars_repo_name": "SVoyt/esri-leaflet-dynamic-advanced", "max_stars_repo_stars_event_min_datetime": "2016-02-27T20:48:38.000Z", "max_stars_repo_stars_event_max_datetime": "2020-06-28T16:53:16.000Z", "max_issues_repo_path": "spec/DynamicMapLayerAdvancedSpec.js", "max_issues_repo_name": "SVoyt/esri-leaflet-dynamic-advanced", "max_issues_repo_issues_event_min_datetime": "2016-03-30T11:17:21.000Z", "max_issues_repo_issues_event_max_datetime": "2020-01-22T22:56:03.000Z", "max_forks_repo_path": "spec/DynamicMapLayerAdvancedSpec.js", "max_forks_repo_name": "SVoyt/esri-leaflet-dynamic-advanced", "max_forks_repo_forks_event_min_datetime": "2016-02-28T20:39:51.000Z", "max_forks_repo_forks_event_max_datetime": "2020-03-06T20:19:48.000Z"}
{"max_stars_count": 8, "max_issues_count": 5, "max_forks_count": 7, "avg_line_length": 33.25, "max_line_length": 98, "alphanum_fraction": 0.6992481203}
describe('L.esri.DynamicMapLayerAdvanced', function() {
  this.timeout(15000);

  function createMap() {
    var container = document.createElement('div');
    container.setAttribute('style', 'width: 500px; height: 500px;');
    document.body.appendChild(container);
    return L.map(container).setView([0, 180], 2);
  }

  var url = 'http://services.arcgisonline.com/arcgis/rest/services/World_Shaded_Relief/MapServer';
  var layer;
  var map;

  beforeEach(function() {
    layer = L.esri.dynamicMapLayerAdvanced({
      url: url,
      f:'image'
    });
    map = createMap();
  });

  afterEach(function() {
    map.remove();
  });


  it('should have a L.esri.dynamicMapLayerAdvanced alias', function() {
    expect(L.esri.dynamicMapLayerAdvanced({
      url: url
    })).to.be.instanceof(L.esri.DynamicMapLayerAdvanced);
  });

  it('should request two proper bounds', function() {

    var southWest1 = L.latLng(-65.65827451982662, 92.10937500000001),
        northEast1 = L.latLng(65.6582745198266, 180),
        bounds1 = L.latLngBounds(southWest1, northEast1);

    var southWest2 = L.latLng(-65.65827451982662, -180),
        northEast2 = L.latLng(65.6582745198266, -92.10937499999994),
        bounds2 = L.latLngBounds(southWest2, northEast2);


    layer.addTo(map);
    var paramsArray = layer._buildExportParams();

    //need to deep.closeTo :(

    expect(paramsArray[0].bounds._southWest.lat).to.closeTo(bounds1._southWest.lat, 0.00001);
    expect(paramsArray[0].bounds._southWest.lng).to.closeTo(bounds1._southWest.lng, 0.00001);
    expect(paramsArray[0].bounds._northEast.lat).to.closeTo(bounds1._northEast.lat, 0.00001);
    expect(paramsArray[0].bounds._northEast.lng).to.closeTo(bounds1._northEast.lng, 0.00001);

    expect(paramsArray[1].bounds._southWest.lat).to.closeTo(bounds2._southWest.lat, 0.00001);
    expect(paramsArray[1].bounds._southWest.lng).to.closeTo(bounds2._southWest.lng, 0.00001);
    expect(paramsArray[1].bounds._northEast.lat).to.closeTo(bounds2._northEast.lat, 0.00001);
    expect(paramsArray[1].bounds._northEast.lng).to.closeTo(bounds2._northEast.lng, 0.00001);

  });


});
