require 'test_helper'

class Everypolitician::Popolo::JsonTest < Minitest::Test
  def popolo_json
    @popolo_json ||= Everypolitician::Popolo::JSON.new(
      events: [
        { name: 'Election 1', classification: 'general election', start_date: '2014-01-01' },
        { name: 'Term 2', classification: 'legislative period', start_date: '2015-01-01' },
        { name: 'Term 1', classification: 'legislative period', start_date: '2010-01-01' },
      ],
    )
  end

  def test_legislative_periods_ignores_other_event_types
    assert_equal 2, popolo_json.legislative_periods.size
    assert_equal 2, popolo_json.terms.size
  end

  def test_current_legislative_period_returns_correct_term
    assert_equal 'Term 2', popolo_json.current_legislative_period.name
    assert_equal 'Term 2', popolo_json.current_term.name
  end
end

require 'test_helper'

class Everypolitician::Popolo::JsonTest < Minitest::Test
  def popolo_json
    @popolo_json ||= Everypolitician::Popolo::JSON.new(
      events: [
        { name: 'Election 1', classification: 'general election', start_date: '2014-01-01' },
        { name: 'Term 2', classification: 'legislative period', start_date: '2015-01-01' },
        { name: 'Term 1', classification: 'legislative period', start_date: '2010-01-01' },
      ],
    )
  end

  def test_legislative_periods_ignores_other_event_types
    assert_equal 2, popolo_json.legislative_periods.size
  end

  def test_current_legislative_period_returns_correct_term
    assert_equal 'Term 2', popolo_json.current_legislative_period.name
  end

  def test_that_terms_returns_the_same_as_legislative_periods
    assert_equal popolo_json.terms, popolo_json.legislative_periods
  end
end

Split out a separate test for `terms`
Split out a separate test for `terms`

Rather than just asserting that the lists have the same number of
elements, or an entry with the same name, actually test that the lists
for each are the same.
