<commit_before>_ = require 'underscore'
benv = require 'benv'
sinon = require 'sinon'
Article = require '../../../../../models/article'
Backbone = require 'backbone'
fixtures = require '../../../../../../test/helpers/fixtures'
{ fabricate } = require 'antigravity'
{ resolve } = require 'path'

describe 'EditAdmin', ->

  beforeEach (done) ->
    benv.setup =>
      tmpl = resolve __dirname, '../index.jade'
      benv.render tmpl, _.extend(fixtures().locals,
        article: @article = new Article fixtures().article
      ), =>
        benv.expose $: require('jquery')
        Backbone.$ = $
        sinon.stub Backbone, 'sync'
        EditAdmin = benv.requireWithJadeify '../index',
          ['featuredListTemplate']
        EditAdmin::setupAuthorAutocomplete = sinon.stub()
        EditAdmin::setupFairAutocomplete = sinon.stub()
        EditAdmin::setupPartnerAutocomplete = sinon.stub()
        EditAdmin::setupAuctionAutocomplete = sinon.stub()
        EditAdmin::setupVerticalAutocomplete = sinon.stub()
        EditAdmin::setupShowsAutocomplete = sinon.stub()
        EditAdmin::setupBiographyAutocomplete = sinon.stub()
        EditAdmin::setupSlug = sinon.stub()
        EditAdmin::setupPublishDate = sinon.stub()
        EditAdmin::setupContributingAuthors = sinon.stub()
        @view = new EditAdmin el: $('#edit-admin'), article: @article
        done()

  afterEach ->
    benv.teardown(false)
    Backbone.sync.restore()

  describe '#onOpen', ->

    it 'fetches featured and mentioned articles', ->
      @view.article.fetchFeatured = sinon.stub()
      @view.article.fetchMentioned = sinon.stub()
      @view.onOpen()
      @view.article.fetchFeatured.called.should.be.ok
      @view.article.fetchMentioned.called.should.be.ok<commit_msg>Fixes test<commit_after>_ = require 'underscore'
benv = require 'benv'
sinon = require 'sinon'
Article = require '../../../../../models/article'
Backbone = require 'backbone'
fixtures = require '../../../../../../test/helpers/fixtures'
{ fabricate } = require 'antigravity'
{ resolve } = require 'path'

describe 'EditAdmin', ->

  beforeEach (done) ->
    benv.setup =>
      tmpl = resolve __dirname, '../index.jade'
      benv.render tmpl, _.extend(fixtures().locals,
        article: @article = new Article fixtures().article
      ), =>
        benv.expose $: require('jquery')
        Backbone.$ = $
        sinon.stub Backbone, 'sync'
        EditAdmin = benv.requireWithJadeify '../index',
          ['featuredListTemplate']
        EditAdmin::setupAuthorAutocomplete = sinon.stub()
        EditAdmin::setupFairAutocomplete = sinon.stub()
        EditAdmin::setupPartnerAutocomplete = sinon.stub()
        EditAdmin::setupAuctionAutocomplete = sinon.stub()
        EditAdmin::setupSectionAutocomplete = sinon.stub()
        EditAdmin::setupShowsAutocomplete = sinon.stub()
        EditAdmin::setupBiographyAutocomplete = sinon.stub()
        EditAdmin::setupSlug = sinon.stub()
        EditAdmin::setupPublishDate = sinon.stub()
        EditAdmin::setupContributingAuthors = sinon.stub()
        @view = new EditAdmin el: $('#edit-admin'), article: @article
        done()

  afterEach ->
    benv.teardown(false)
    Backbone.sync.restore()

  describe '#onOpen', ->

    it 'fetches featured and mentioned articles', ->
      @view.article.fetchFeatured = sinon.stub()
      @view.article.fetchMentioned = sinon.stub()
      @view.onOpen()
      @view.article.fetchFeatured.called.should.be.ok
      @view.article.fetchMentioned.called.should.be.ok
{'fraction_non_alphanumeric': 0.1471590909090909, 'fraction_numerical': 0.0, 'mean_word_length': 2.9384787472035794, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '1455690', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1068, 'n_words': 194}