<commit_before>expect = require("chai").expect
Processor = require("../../../src/processors/fallback_processor")

stack = "at ErrorMaker (http://localhost:9001/test/examples/js/error.js:2:6)"

describe "FallbackProcessor", ->
  describe "#process", ->
    processor = new Processor()

    it "determines error type", ->
      result = processor.process(stack: "SyntaxError: unexpected }")
      expect(result.type).to.equal("SyntaxError")

    it "uses `Error` for unknown error type", ->
      result = processor.process()
      expect(result.type).to.equal("Error")

    describe ".backtrace", ->
      it "has backtrace", ->
        result = processor.process()
        expect(result.backtrace).to.be.an('array')

      it "recognizes line numbers", ->
        result = processor.process(stack: stack)
        backtrace_line = result.backtrace[0]
        console.dir backtrace_line
        expect(backtrace_line.line).to.equal('2')

      it "recognizes files", ->
        result = processor.process(stack: stack)
        backtrace_line = result.backtrace[0]
        expect(backtrace_line.file).to.equal('http://localhost:9001/test/examples/js/error.js')

      it "recognizes functions", ->
        result = processor.process(stack: stack)
        backtrace_line = result.backtrace[0]
        expect(backtrace_line.function).to.equal('ErrorMaker')<commit_msg>Remove console call<commit_after>expect = require("chai").expect
Processor = require("../../../src/processors/fallback_processor")

stack = "at ErrorMaker (http://localhost:9001/test/examples/js/error.js:2:6)"

describe "FallbackProcessor", ->
  describe "#process", ->
    processor = new Processor()

    it "determines error type", ->
      result = processor.process(stack: "SyntaxError: unexpected }")
      expect(result.type).to.equal("SyntaxError")

    it "uses `Error` for unknown error type", ->
      result = processor.process()
      expect(result.type).to.equal("Error")

    describe ".backtrace", ->
      it "has backtrace", ->
        result = processor.process()
        expect(result.backtrace).to.be.an('array')

      it "recognizes line numbers", ->
        result = processor.process(stack: stack)
        backtrace_line = result.backtrace[0]
        expect(backtrace_line.line).to.equal('2')

      it "recognizes files", ->
        result = processor.process(stack: stack)
        backtrace_line = result.backtrace[0]
        expect(backtrace_line.file).to.equal('http://localhost:9001/test/examples/js/error.js')

      it "recognizes functions", ->
        result = processor.process(stack: stack)
        backtrace_line = result.backtrace[0]
        expect(backtrace_line.function).to.equal('ErrorMaker')
{'fraction_non_alphanumeric': 0.14942528735632185, 'fraction_numerical': 0.010381905821282907, 'mean_word_length': 3.1507692307692308, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '3396132', 'n_tokens_mistral': 804, 'n_tokens_neox': 775, 'n_words': 143}