<commit_before>'use strict'

const expect = require('chai').expect
const CrawlerImdb = require('../index')
const imdbCode = 'tt0944947'

let imdbCrawler = new CrawlerImdb(imdbCode)

describe('#getBasic', function () {
  this.timeout(10000)
  let title = null

  before(function (done) {
    imdbCrawler.getBasic(function (data) {
      title = data
      done()
    })
  })

  it('should get title name', function () {
    expect(title.name).to.equal('Game of Thrones')
  })

  it('should get rating', function () {
    expect(title.rating).to.equal(9.5)
  })

  it('should get image', function () {
    expect(title.image).to.have.string('http')
    expect(title.image).to.match(/.(jpg|jpeg|png|gif)$/i)
  })

  it('should get genres', function () {
    expect(title.genres).to.eql(['Adventure', 'Drama', 'Fantasy', 'Romance'])
  })
})
<commit_msg>Write tests for episode listing<commit_after>'use strict'

const expect = require('chai').expect
const CrawlerImdb = require('../index')
const imdbCode = 'tt0944947'
const imdbCodeMovie = 'tt6788942'

let imdbCrawler = new CrawlerImdb(imdbCode)
let imdbCrawlerNoEps = new CrawlerImdb(imdbCodeMovie)

describe('#getBasic', function () {
  this.timeout(10000)
  let title = null

  before(function (done) {
    imdbCrawler.getBasic(function (data) {
      title = data
      done()
    })
  })

  it('should get title name', function () {
    expect(title.name).to.equal('Game of Thrones')
  })

  it('should get rating', function () {
    expect(title.rating).to.equal(9.5)
  })

  it('should get image', function () {
    expect(title.image).to.have.string('http')
    expect(title.image).to.match(/.(jpg|jpeg|png|gif)$/i)
  })

  it('should get genres', function () {
    expect(title.genres).to.eql(['Adventure', 'Drama', 'Fantasy', 'Romance'])
  })
})

describe('#getEpisodes', function () {
  this.timeout(10000)

  let episodes = null
  before(function (done) {
    imdbCrawler.getEpisodes(imdbCode, function (data) {
      episodes = data
      done()
    })
  })

  it('should get episode list', function () {
    expect(episodes).to.be.an.instanceof(Array)
  })

  it('should get info for single episode', function () {
    expect(episodes[0].name).to.have.string('Winter Is Coming')
    expect(episodes[0].season).to.equal(1)
    expect(episodes[0].epNum).to.equal(1)
    expect(episodes[0].airDate).to.have.string('17 Apr. 2011')
    expect(episodes[0].summary).to.have.string('<NAME>, the Hand of the King, is dead. King <NAME> plans to ask his oldest friend, <NAME>, to take Jon\'s place. Across the sea, Viserys Targaryen plans to wed his sister to a nomadic warlord in exchange for an army.')
    expect(episodes[0].image).to.have.string('http')
    expect(episodes[0].image).to.match(/.(jpg|jpeg|png|gif)$/i)
  })
})

describe('#getEpisodesForMovie', function () {
  this.timeout(10000)

  let episodes = null
  before(function (done) {
    imdbCrawlerNoEps.getEpisodes(imdbCodeMovie, function (data) {
      episodes = data
      done()
    })
  })

  it('should return nothing if title has no episodes', function () {
    expect(episodes).to.be.an.instanceof(Array)
    expect(episodes).to.have.length(0)
  })
})

{'fraction_non_alphanumeric': 0.1657754010695187, 'fraction_numerical': 0.01918842403271469, 'mean_word_length': 3.8036253776435047, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4173110', 'n_tokens_mistral': 1165, 'n_tokens_neox': 1101, 'n_words': 223}