<commit_before><commit_msg>Start test for esriFormatter. Leaving unimplemented, as spec may change<commit_after>assert = require('chai').assert
sinon = require('sinon')

Indicator = require('../../models/indicator')
EsriFormatter = require('../../formatters/esri')

suite('Esri Formatter')

test('Esri query result, it formats it correctly', ->
  rawData = {
    "features": [
      {
          "geometry": {
              "x": 54.374894503000064,
              "y": 24.428641001000074
          },
          "attributes": {
              "OBJECTID": 1,
              "station": "Palace Beach",
              "periodStart": 1356998400000,
              "value": 37,
              "text": "GOOD"
          }
      },
      {
          "geometry": {
              "x": 54.30470040400007,
              "y": 24.465522647000057
          },
          "attributes": {
              "OBJECTID": 3,
              "station": "Emirates Palace Beach",
              "periodStart": 1364774400000,
              "value": 50,
              "text": "GOOD"
          }
      },
      {
          "geometry": {
              "x": 54.30470040400007,
              "y": 24.465522647000057
          },
          "attributes": {
              "OBJECTID": 15,
              "station": "Emirates Palace Beach",
              "periodStart": 1356998400000,
              "value": 160,
              "text": "BAD"
          }
      },
      {
          "geometry": {
              "x": 54.374894503000064,
              "y": 24.428641001000074
          },
          "attributes": {
              "OBJECTID": 25,
              "station": "Palace Beach",
              "periodStart": 1364774400000,
              "value": 400,
              "text": "BAD"
          }
      }
    ]
  }

  expectedResult = [{
    "date": "2013-01-01T00:00:00.000Z",
    "station": [{
      "text": "GOOD",
      "value": 37,
      "periodStart": 1356998400000,
      "station": "Palace Beach",
      "geometry": {
        "y": 24.428641001000074,
        "x": 54.374894503000064
      }
    }]
  },
  {
    "date": "2013-04-01T00:00:00.000Z",
    "station": [{
      "text": "GOOD",
      "value": 50,
      "periodStart": 1364774400000,
      "station": "Emirates Palace Beach",
      "geometry": {
        "y": 24.465522647000057,
        "x": 54.30470040400007
      }
    }]
  }]

  indicator = new Indicator(
    reduceField: 'station'
  )

  actualResult = EsriFormatter(rawData, indicator)

  assert.deepEqual actualResult, expectedResult
)
{'fraction_non_alphanumeric': 0.1477635782747604, 'fraction_numerical': 0.13298722044728434, 'mean_word_length': 1.5075075075075075, 'pattern_counts': {'":': 55, '<': 3, '<?xml version=': 0, '>': 4, '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': '6116778', 'n_tokens_mistral': 1008, 'n_tokens_neox': 772, 'n_words': 145}