<commit_before>
{ expect } = require('chai')

SL = require '../src/index.coffee'

keys =
  realtimeInformation: 'xxx'
  locationLookup: 'xxx'
  tripPlanner: 'xxx'
  trafficSituation: 'xxx'
  disturbanceInformation: 'xxx'

describe 'SL (Storstockholms Lokaltrafik) API Wrapper', ()->

  describe 'new SL()', ()->
    it "should throw NoKeySuppliedError", ->
      noKeySupplied = -> new SL()
      expect( noKeySupplied ).to.throw /One of the following API keys have to be supplied/

  describe 'new SL("string")', ()->
    it "should throw InvalidKeyFormatSuppliedError", ->
      invalidKeyFormatSupplied = -> new SL("string")
      expect( invalidKeyFormatSupplied ).to.throw /The supplied API key\(s\) has to be an object/

  describe 'new SL({realtimeInformation: "xxx", wrongKeyName: "xxx"})', ()->
    it "should throw InvalidKeyNameSuppliedError", ->
      InvalidKeyNameSupplied = -> new SL({realtimeInformation: "xxx", wrongKeyName: "xxx"})
      expect( InvalidKeyNameSupplied ).to.throw /The supplied key (.*) should be one of the following/


<commit_msg>Add test for suppying invalid response format<commit_after>
{ expect } = require('chai')

SL = require '../src/index.coffee'

keys =
  realtimeInformation: 'xxx'
  locationLookup: 'xxx'
  tripPlanner: 'xxx'
  trafficSituation: 'xxx'
  disturbanceInformation: 'xxx'

describe 'SL (Storstockholms Lokaltrafik) API Wrapper', ()->

  describe 'new SL()', ()->
    it "should throw NoKeySuppliedError", ->
      noKeySupplied = -> new SL()
      expect( noKeySupplied ).to.throw /One of the following API keys have to be supplied/

  describe 'new SL("string")', ()->
    it "should throw InvalidKeyFormatSuppliedError", ->
      invalidKeyFormatSupplied = -> new SL("string")
      expect( invalidKeyFormatSupplied ).to.throw /The supplied API key\(s\) has to be an object/

  describe 'new SL({realtimeInformation: "xxx", wrongKeyName: "xxx"})', ()->
    it "should throw InvalidKeyNameSuppliedError", ->
      invalidKeyNameSupplied = -> new SL({realtimeInformation: "xxx", wrongKeyName: "xxx"})
      expect( invalidKeyNameSupplied ).to.throw /The supplied key (.*) should be one of the following/

  describe 'new SL({realtimeInformation: "xxx"}, "txt")', ()->
    it "should throw InvalidResponseFormatSuppliedError", ->
      invalidResponseFormatSupplied = -> new SL({realtimeInformation: "xxx"}, "txt")
      expect( invalidResponseFormatSupplied ).to.throw /(.*) which you supplied is not supported./



{'fraction_non_alphanumeric': 0.13818181818181818, 'fraction_numerical': 0.0, 'mean_word_length': 3.9818913480885314, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 26, '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': '2528615', 'n_tokens_mistral': 751, 'n_tokens_neox': 725, 'n_words': 221}