<commit_before>import {expect} from 'chai'
import Ember from 'ember'
const {run} = Ember
import {describeComponent} from 'ember-mocha'
import PropTypeMixin from 'ember-prop-types'
import {
  beforeEach,
  it
} from 'mocha'
import sinon from 'sinon'

describeComponent(
  'frost-list',
  'Unit: FrostListComponent',
  {
    unit: true
  },
  function () {
    let component

    beforeEach(function () {
      component = this.subject()
    })

    it('sets default properties value correctly', function () {
      expect(
        component.get('alwaysUseDefaultHeight'),
        'alwaysUseDefaultHeight: false'
      ).to.eql(false)
    })

    it('has the expected Mixins', function () {
      expect(
        PropTypeMixin.detect(component),
        'PropTypeMixin Mixin is present'
      ).to.eql(true)
    })

    it('InitContext() errors when config is set with item, expansion or sorting', function () {
      const EmberLoggerSpy = sinon.spy(Ember.Logger, 'error')

      run(() => {
        component.set('config', {})
        component.set('expansion', {})
      })

      component.initContext()

      expect(
        EmberLoggerSpy.called,
        'Logger.error is called'
      ).to.eql(true)
    })
  }
)
<commit_msg>added a few more tests for initContext and added restore() for spies<commit_after>import {expect} from 'chai'
import Ember from 'ember'
const {run} = Ember
import {describeComponent} from 'ember-mocha'
import PropTypeMixin from 'ember-prop-types'
import {
  beforeEach,
  describe,
  it
} from 'mocha'
import sinon from 'sinon'

describeComponent(
  'frost-list',
  'Unit: FrostListComponent',
  {
    unit: true
  },
  function () {
    let component

    beforeEach(function () {
      component = this.subject()
    })

    it('sets default properties value correctly', function () {
      expect(
        component.get('alwaysUseDefaultHeight'),
        'alwaysUseDefaultHeight: false'
      ).to.eql(false)
    })

    it('has the expected Mixins', function () {
      expect(
        PropTypeMixin.detect(component),
        'PropTypeMixin Mixin is present'
      ).to.eql(true)
    })

    describe('InitContext()', function () {
      it('errors when config is set with item', function () {
        const EmberLoggerSpy = sinon.spy(Ember.Logger, 'error')

        run(() => {
          component.set('config', {})
          component.set('item', {})
        })

        component.initContext()

        expect(
          EmberLoggerSpy.called,
          'Logger.error is called'
        ).to.eql(true)

        Ember.Logger.error.restore()
      })

      it('errors when config is set with expansion', function () {
        const EmberLoggerSpy = sinon.spy(Ember.Logger, 'error')

        run(() => {
          component.set('config', {})
          component.set('expansion', {})
        })

        component.initContext()

        expect(
          EmberLoggerSpy.called,
          'Logger.error is called'
        ).to.eql(true)

        Ember.Logger.error.restore()
      })

      it('errors when config is set with sorting', function () {
        const EmberLoggerSpy = sinon.spy(Ember.Logger, 'error')

        run(() => {
          component.set('config', {})
          component.set('sorting', {})
        })

        component.initContext()

        expect(
          EmberLoggerSpy.called,
          'Logger.error is called'
        ).to.eql(true)

        Ember.Logger.error.restore()
      })

      it('does not error when config is set by itself', function () {
        const EmberLoggerSpy = sinon.spy(Ember.Logger, 'error')

        run(() => component.set('config', {}))

        component.initContext()

        expect(
          EmberLoggerSpy.called,
          'Logger.error is not called'
        ).to.eql(false)

        Ember.Logger.error.restore()
      })
    })
  }
)

{'fraction_non_alphanumeric': 0.13142112125162972, 'fraction_numerical': 0.0, 'mean_word_length': 2.29553264604811, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '7545269', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1138, 'n_words': 260}