<commit_before>require 'spec_helper'

describe GeojsonService do
  let(:good_coordinates) {
    [
        [5.93536376953125,
         48.91888968903368],
        [5.93536376953125,
         49.26780455063753],
        [7.094421386718749,
         49.26780455063753],
        [7.094421386718749,
         48.91888968903368],
        [5.93536376953125,
         48.91888968903368]
    ]
  }

  describe '.toGeoJsonPolygonForQp' do
    subject { JSON.parse(described_class.to_json_polygon_for_qp coordinates) }

    describe 'coordinates are empty' do
      let(:coordinates) { '' }

      it { expect(subject['geo']['type']).to eq('Polygon') }
      it { expect(subject['geo']['coordinates']).to eq([coordinates]) }
    end

    describe 'coordinates are informed' do
      let(:coordinates) { good_coordinates }

      it { expect(subject['geo']['type']).to eq('Polygon') }
      it { expect(subject['geo']['coordinates']).to eq([coordinates]) }
    end
  end

  describe '.toGeoJsonPolygonForCadastre' do
    subject { JSON.parse(described_class.to_json_polygon_for_cadastre coordinates) }

    describe 'coordinates are empty' do
      let(:coordinates) { '' }

      it { expect(subject['geom']['type']).to eq('Feature') }
      it { expect(subject['geom']['geometry']['type']).to eq('Polygon') }
      it { expect(subject['geom']['geometry']['coordinates']).to eq([[coordinates]]) }
    end

    describe 'coordinates are informed' do
      let(:coordinates) { good_coordinates }

      it { expect(subject['geom']['type']).to eq('Feature') }
      it { expect(subject['geom']['geometry']['type']).to eq('Polygon') }
      it { expect(subject['geom']['geometry']['coordinates']).to eq([[coordinates]]) }
    end
  end
end<commit_msg>fix test<commit_after>require 'spec_helper'

describe GeojsonService do
  let(:good_coordinates) {
    [
        [5.93536376953125,
         48.91888968903368],
        [5.93536376953125,
         49.26780455063753],
        [7.094421386718749,
         49.26780455063753],
        [7.094421386718749,
         48.91888968903368],
        [5.93536376953125,
         48.91888968903368]
    ]
  }

  describe '.toGeoJsonPolygonForQp' do
    subject { JSON.parse(described_class.to_json_polygon_for_qp coordinates) }

    describe 'coordinates are empty' do
      let(:coordinates) { '' }

      it { expect(subject['geo']['type']).to eq('Polygon') }
      it { expect(subject['geo']['coordinates']).to eq([coordinates]) }
    end

    describe 'coordinates are informed' do
      let(:coordinates) { good_coordinates }

      it { expect(subject['geo']['type']).to eq('Polygon') }
      it { expect(subject['geo']['coordinates']).to eq([coordinates]) }
    end
  end

  describe '.toGeoJsonPolygonForCadastre' do
    subject { JSON.parse(described_class.to_json_polygon_for_cadastre coordinates) }

    describe 'coordinates are empty' do
      let(:coordinates) { '' }

      it { expect(subject['geom']['type']).to eq('Feature') }
      it { expect(subject['geom']['geometry']['type']).to eq('Polygon') }
      it { expect(subject['geom']['geometry']['coordinates']).to eq([coordinates]) }
    end

    describe 'coordinates are informed' do
      let(:coordinates) { good_coordinates }

      it { expect(subject['geom']['type']).to eq('Feature') }
      it { expect(subject['geom']['geometry']['type']).to eq('Polygon') }
      it { expect(subject['geom']['geometry']['coordinates']).to eq([coordinates]) }
    end
  end
end
{'fraction_non_alphanumeric': 0.16113196650303205, 'fraction_numerical': 0.09067282702858794, 'mean_word_length': 3.3848101265822783, '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': '5699157', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1139, 'n_words': 182}