<commit_before>_ = require 'underscore'
cheerio = require 'cheerio'
path = require 'path'
jade = require 'jade'
fs = require 'fs'
moment = require 'moment'
Article = require '../../../models/article'
Articles = require '../../../collections/articles'
fixtures = require '../../../test/helpers/fixtures'

render = (templateName) ->
  filename = path.resolve __dirname, "../templates/#{templateName}.jade"
  jade.compile(
    fs.readFileSync(filename),
    { filename: filename }
  )

describe 'article show template', ->

  it 'renders sectionless articles', ->
    html = render('index')
      article: new Article title: 'hi', sections: [], section_ids: []
      footerArticles: new Articles
      crop: (url) -> url
      moment: moment
      sd: {}
      asset: ->
    html.should.containEql 'hi'<commit_msg>Adds a test<commit_after>_ = require 'underscore'
cheerio = require 'cheerio'
path = require 'path'
jade = require 'jade'
fs = require 'fs'
moment = require 'moment'
Article = require '../../../models/article'
Articles = require '../../../collections/articles'
fixtures = require '../../../test/helpers/fixtures'

render = (templateName) ->
  filename = path.resolve __dirname, "../templates/#{templateName}.jade"
  jade.compile(
    fs.readFileSync(filename),
    { filename: filename }
  )

describe 'article show template', ->

  it 'renders sectionless articles', ->
    html = render('index')
      article: new Article title: 'hi', sections: [], section_ids: []
      footerArticles: new Articles
      crop: (url) -> url
      moment: moment
      sd: {}
      asset: ->
    html.should.containEql 'hi'

  it 'renders fullscreen headers with video', ->
    html = render('index')
      article: new Article
        title: 'hi'
        sections: []
        hero_section:
          type: 'fullscreen'
          background_url: 'http://video.mp4'
      footerArticles: new Articles
      crop: (url) -> url
      moment: moment
      sd: {}
      asset: ->
    html.should.containEql 'article-fullscreen-video-player'

  it 'renders fullscreen headers with static image', ->
    html = render('index')
      article: new Article
        title: 'hi'
        sections: []
        hero_section:
          type: 'fullscreen'
          background_image_url: 'http://image.jpg'
      footerArticles: new Articles
      crop: (url) -> url
      moment: moment
      sd: {}
      asset: ->
    html.should.containEql 'article-fullscreen-image'

{'fraction_non_alphanumeric': 0.14728682170542637, 'fraction_numerical': 0.0004079967360261118, 'mean_word_length': 2.6272189349112427, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '4878767', 'n_tokens_mistral': 743, 'n_tokens_neox': 734, 'n_words': 196}