<commit_before>define ['contextFactory'], (ContextFactory) ->
  describe 'ContextFactory', ->
    it 'should be defined', ->
      expect(ContextFactory).toBeDefined()

    it 'should be a function', ->
      expect(ContextFactory).toBeAFunction()

    describe 'returnable DSL object', ->
      subject      =
      JasmineStore = undefined

      beforeEach ->
        Jasmine      = jasmine.createSpyObj('JasmineMock', ['beforeEach', 'afterEach'])
        JasmineStore = jasmine.createSpyObj('JasmineStoreMock', ['set', 'defined'])

        JasmineStore.defined.and.returnValue true
        JasmineStore.instance = Jasmine

        subject = new ContextFactory(null, null, JasmineStore)

      it 'interface', ->
        expect(subject).toHaveProperties ['is']

      describe '#is', ->
        fn       =
        name     =
        store    =
        factory  = undefined

        beforeEach ->
          name    = 'collection'
          store   = {}
          factory = new ContextFactory(name, store, JasmineStore)

        describe 'first - plain val', ->

          beforeEach -> factory.is 'something'

          it 'should add new key to store', ->
            expect(store).toHaveProperties [name]

          it 'should assign proper value to key in store', ->
            expect(store[name]).toEqual 'something'

        describe 'first - function', ->

          beforeEach ->
            fn = -> 'function result'
            factory.is fn

          it 'should add new key to store', ->
            expect(store).toHaveProperties [name]

          it 'should assign function to key in store', ->
            expect(store[name]).toBe fn

        describe 'first - plain val, second - function ', ->

          beforeEach ->
            fn = -> 'function result'
            factory.is 'something', fn

          it 'should add new key to store', ->
            expect(store).toHaveProperties [name]

          it 'should assign proper value to key in store', ->
            expect(store[name]).toEqual 'something'

        describe 'first - function, second - plain val', ->

          beforeEach ->
            fn = -> 'function result'
            factory.is fn, 'something'

          it 'should add new key to store', ->
            expect(store).toHaveProperties [name]

          it 'should assign function to key in store', ->
            expect(store[name]).toBe fn
<commit_msg>contextFactory new tests<commit_after>define ['contextFactory'], (ContextFactory) ->
  describe 'ContextFactory', ->
    it 'should be defined', ->
      expect(ContextFactory).toBeDefined()

    it 'should be a function', ->
      expect(ContextFactory).toBeAFunction()

    describe 'returnable DSL object', ->
      subject      =
      JasmineStore = undefined

      beforeEach ->
        Jasmine      = jasmine.createSpyObj('JasmineMock', ['beforeEach', 'afterEach'])
        JasmineStore = jasmine.createSpyObj('JasmineStoreMock', ['set', 'defined'])

        JasmineStore.defined.and.returnValue true
        JasmineStore.instance = Jasmine

        subject = new ContextFactory(null, null, JasmineStore)

      it 'interface', ->
        expect(subject).toHaveProperties ['is']

      describe '#is', ->
        fn             =
        name           =
        store          =
        factory        =
        afterEachArgs1 =
        afterEachArgs2 =
        beforeEachArgs = undefined

        beforeEach ->
          name    = 'collection'
          store   = {}
          factory = new ContextFactory(name, store, JasmineStore)
          beforeEachArgs = /return eval\("var " \+ prop \+ " = " \+ Store\[prop\] \+ ";"\);/
          afterEachArgs1 = /delete Store\[prop\];/
          afterEachArgs2 = /return eval\("delete " \+ prop \+ ";"\);/

        describe 'first - plain val', ->

          beforeEach -> factory.is 'something'

          it 'should add new key to store', ->
            expect(store).toHaveProperties [name]

          it 'should assign proper value to key in store', ->
            expect(store[name]).toEqual 'something'

          it 'should call jasmine\'s beforeEach method', ->
            expect(JasmineStore.instance.beforeEach).toHaveBeenCalled()
            expect(JasmineStore.instance.beforeEach.calls.count()).toBe 1
            expect(JasmineStore.instance.beforeEach.calls.argsFor(0)).toMatch beforeEachArgs

          it 'should call jasmine\'s afterEach method', ->
            expect(JasmineStore.instance.afterEach).toHaveBeenCalled()
            expect(JasmineStore.instance.afterEach.calls.count()).toBe 1
            expect(JasmineStore.instance.afterEach.calls.argsFor(0)).toMatch afterEachArgs1
            expect(JasmineStore.instance.afterEach.calls.argsFor(0)).toMatch afterEachArgs2

        describe 'first - function', ->

          beforeEach ->
            fn = -> 'function result'
            factory.is fn

          it 'should add new key to store', ->
            expect(store).toHaveProperties [name]

          it 'should assign function to key in store', ->
            expect(store[name]).toBe fn

          it 'should call jasmine\'s beforeEach method', ->
            expect(JasmineStore.instance.beforeEach).toHaveBeenCalled()
            expect(JasmineStore.instance.beforeEach.calls.count()).toBe 1
            expect(JasmineStore.instance.beforeEach.calls.argsFor(0)).toMatch beforeEachArgs

          it 'should call jasmine\'s afterEach method', ->
            expect(JasmineStore.instance.afterEach).toHaveBeenCalled()
            expect(JasmineStore.instance.afterEach.calls.count()).toBe 1
            expect(JasmineStore.instance.afterEach.calls.argsFor(0)).toMatch afterEachArgs1
            expect(JasmineStore.instance.afterEach.calls.argsFor(0)).toMatch afterEachArgs2

        describe 'first - plain val, second - function ', ->

          beforeEach ->
            fn = -> 'function result'
            factory.is 'something', fn

          it 'should add new key to store', ->
            expect(store).toHaveProperties [name]

          it 'should assign proper value to key in store', ->
            expect(store[name]).toEqual 'something'

          it 'should call jasmine\'s beforeEach method', ->
            expect(JasmineStore.instance.beforeEach).toHaveBeenCalled()
            expect(JasmineStore.instance.beforeEach.calls.count()).toBe 1
            expect(JasmineStore.instance.beforeEach.calls.argsFor(0)).toMatch beforeEachArgs

          it 'should call jasmine\'s afterEach method', ->
            expect(JasmineStore.instance.afterEach).toHaveBeenCalled()
            expect(JasmineStore.instance.afterEach.calls.count()).toBe 1
            expect(JasmineStore.instance.afterEach.calls.argsFor(0)).toMatch afterEachArgs1
            expect(JasmineStore.instance.afterEach.calls.argsFor(0)).toMatch afterEachArgs2

        describe 'first - function, second - plain val', ->

          beforeEach ->
            fn = -> 'function result'
            factory.is fn, 'something'

          it 'should add new key to store', ->
            expect(store).toHaveProperties [name]

          it 'should assign function to key in store', ->
            expect(store[name]).toBe fn

          it 'should call jasmine\'s beforeEach method', ->
            expect(JasmineStore.instance.beforeEach).toHaveBeenCalled()
            expect(JasmineStore.instance.beforeEach.calls.count()).toBe 1
            expect(JasmineStore.instance.beforeEach.calls.argsFor(0)).toMatch beforeEachArgs

          it 'should call jasmine\'s afterEach method', ->
            expect(JasmineStore.instance.afterEach).toHaveBeenCalled()
            expect(JasmineStore.instance.afterEach.calls.count()).toBe 1
            expect(JasmineStore.instance.afterEach.calls.argsFor(0)).toMatch afterEachArgs1
            expect(JasmineStore.instance.afterEach.calls.argsFor(0)).toMatch afterEachArgs2

{'fraction_non_alphanumeric': 0.11173184357541899, 'fraction_numerical': 0.004062976130015236, 'mean_word_length': 2.185200161746866, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 67, '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': '2951486', 'n_tokens_mistral': 2117, 'n_tokens_neox': 2017, 'n_words': 475}