<commit_before>/* eslint no-shadow:[0] */
import test from 'tape';
import mapboxgl from 'mapbox-gl';
import GLDraw from '../';

mapboxgl.accessToken = '<KEY>';

function createMap() {
  var div = document.createElement('div');
  div.setAttribute('id', 'map');
  document.body.appendChild(div);

  var map = new mapboxgl.Map({
    container: 'map',
    style: 'mapbox://styles/mapbox/streets-v8'
  });

  return map;
}

var feature = {
  type: 'Feature',
  geometry: {
    type: 'Point',
    coordinates: [0, 0]
  }
};

test('API test', t => {

  var map = createMap();
  var Draw = GLDraw();
  map.addControl(Draw);

  var id;

  t.test('set', t => {
    id = Draw.set(feature);
    t.ok(id, 'valid string id returned on set');

    // set permanent feature
    id = Draw.set(feature, { permanent: true });
    var point = map.project(new mapboxgl.LngLat(...feature.geometry.coordinates));
    map.fire('click', { point });
    t.equals(
      Draw._editStore.getDrawIds().indexOf(id),
      -1,
      'permanent feature is not inserted into edit store when clicked'
    );
<commit_msg>Put test point at non default coordinates<commit_after>/* eslint no-shadow:[0] */
import test from 'tape';
import mapboxgl from 'mapbox-gl';
import GLDraw from '../';

mapboxgl.accessToken = '<KEY>';

function createMap() {
  var div = document.createElement('div');
  div.setAttribute('id', 'map');
  document.body.appendChild(div);

  var map = new mapboxgl.Map({
    container: 'map',
    style: 'mapbox://styles/mapbox/streets-v8'
  });

  return map;
}

var feature = {
  type: 'Feature',
  geometry: {
    type: 'Point',
    coordinates: [5, 5]
  }
};

test('API test', t => {

  var map = createMap();
  var Draw = GLDraw();
  map.addControl(Draw);

  var id;

  t.test('set', t => {
    id = Draw.set(feature);
    t.ok(id, 'valid string id returned on set');

    // set permanent feature
    id = Draw.set(feature, { permanent: true });
    var point = map.project(new mapboxgl.LngLat(...feature.geometry.coordinates));
    map.fire('click', { point });
    t.equals(
      Draw._editStore.getDrawIds().indexOf(id),
      -1,
      'permanent feature is not inserted into edit store when clicked'
    );

{'fraction_non_alphanumeric': 0.16818181818181818, 'fraction_numerical': 0.004545454545454545, 'mean_word_length': 3.1294559099437147, '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': '7439844', 'n_tokens_mistral': 751, 'n_tokens_neox': 738, 'n_words': 192}