<commit_before>define [
  'underscore'
  'chaplin/mediator'
  'chaplin/lib/router'
  'chaplin/lib/route'
], (_, mediator, Router, Route) ->
  'use strict'

  describe 'Router and Route', ->
    #console.debug 'Router spec'

    # Initialize shared variables
    router = route = params = null

    # matchRoute handler to catch the params
    matchRoute = (_route, _params) ->
      route = _route
      params = _params


    # Create a fresh Router with a fresh Backbone.History before each test
    beforeEach ->
      router = new Router randomOption: 'foo'
      mediator.subscribe 'matchRoute', matchRoute

    afterEach ->
      route = params = null
      router.dispose()
      mediator.unsubscribe 'matchRoute', matchRoute

    it 'should create a Backbone.History instance', ->
      expect(Backbone.history instanceof Backbone.History).toBe true

    it 'should create a Backbone.History instance', ->
      expect(Backbone.history instanceof Backbone.History).toBe true

    it 'should not start the Backbone.History at once', ->
      expect(Backbone.History.started).toBe false

    it 'should fire a matchRoute event', ->
      spy = jasmine.createSpy()
      mediator.subscribe 'matchRoute', spy
      router.match '', 'x#y'
      router.match '', 'z#q'

      router.route '/'
      expect(spy).toHaveBeenCalled()

      mediator.unsubscribe 'matchRoute', spy

    it 'should match correctly', ->
      spy = jasmine.createSpy()
      mediator.subscribe 'matchRoute', spy
      router.match 'correct-match1', 'null#null'
      router.match 'correct-match2', 'null#null'

      routed = router.route '/correct-match1'
      expect(routed).toBe true
      expect(spy.calls.length).toBe 1

      mediator.unsubscribe 'matchRoute', spy

    it 'should match in order specified', ->
      spy = jasmine.createSpy()
      mediator.subscribe 'matchRoute', spy
      router.match 'params/:one', 'null#null'
      router.match 'params/:two', 'null#null'

      routed = router.route '/params/1'

      expect(params.one).toBe '1'
      expect(params.two).toBe undefined
<commit_msg>remove some stuff I was testing with<commit_after>define [
  'underscore'
  'chaplin/mediator'
  'chaplin/lib/router'
  'chaplin/lib/route'
], (_, mediator, Router, Route) ->
  'use strict'

  describe 'Router and Route', ->
    #console.debug 'Router spec'

    # Initialize shared variables
    router = route = params = null

    # matchRoute handler to catch the params
    matchRoute = (_route, _params) ->
      route = _route
      params = _params

    # Create a fresh Router with a fresh Backbone.History before each test
    beforeEach ->
      router = new Router randomOption: 'foo'
      mediator.subscribe 'matchRoute', matchRoute

    afterEach ->
      route = params = null
      router.dispose()
      mediator.unsubscribe 'matchRoute', matchRoute

    it 'should create a Backbone.History instance', ->
      expect(Backbone.history instanceof Backbone.History).toBe true

    it 'should create a Backbone.History instance', ->
      expect(Backbone.history instanceof Backbone.History).toBe true

    it 'should not start the Backbone.History at once', ->
      expect(Backbone.History.started).toBe false

    it 'should fire a matchRoute event', ->
      spy = jasmine.createSpy()
      mediator.subscribe 'matchRoute', spy
      router.match '', 'x#y'

      router.route '/'
      expect(spy).toHaveBeenCalled()

      mediator.unsubscribe 'matchRoute', spy

    it 'should match correctly', ->
      spy = jasmine.createSpy()
      mediator.subscribe 'matchRoute', spy
      router.match 'correct-match1', 'null#null'
      router.match 'correct-match2', 'null#null'

      routed = router.route '/correct-match1'
      expect(routed).toBe true
      expect(spy.calls.length).toBe 1

      mediator.unsubscribe 'matchRoute', spy

    it 'should match in order specified', ->
      spy = jasmine.createSpy()
      mediator.subscribe 'matchRoute', spy
      router.match 'params/:one', 'null#null'
      router.match 'params/:two', 'null#null'

      routed = router.route '/params/1'

      expect(params.one).toBe '1'
      expect(params.two).toBe undefined

{'fraction_non_alphanumeric': 0.1132934131736527, 'fraction_numerical': 0.002874251497005988, 'mean_word_length': 2.8523985239852396, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, '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': '2107710', 'n_tokens_mistral': 1241, 'n_tokens_neox': 1209, 'n_words': 332}