Sha256: daa76454f219711f5f4781931645105f1e7b6b96eff6b7772e4bae8ab2a25f62

Contents?: true

Size: 1.59 KB

Versions: 6

Compression:

Stored size: 1.59 KB

Contents

require 'test_helper'

class EveApp::ItemParserTest < ActiveSupport::TestCase
  def parsed_items(input)
    parser = EveApp::ItemParser.new(input)
		parser.items.map { |i| [i.type.name, i.quantity] }
  end

  test "parse EFT header" do
    input = "[Garmur, Roaming Garmur]"
    parser = EveApp::ItemParser.new(input)

    assert parser.header?
    assert_equal 'Roaming Garmur', parser.header.name
    assert_equal types(:garmur).id, parser.header.type.try(:id)
  end

  test "parse an EFT text" do
		result = parsed_items(load_data_file('eft.txt'))
    expected = [
      ['Orthrus', 1], ['10MN Afterburner II', 10], ['100MN Afterburner I', 100], ['Warp Scrambler II', 5],
      ['Tracking Computer II', 1], ['800mm Repeating Cannon II', 3], ['Sensor Booster II', 2],
      ['Heavy Energy Neutralizer II', 300], ['Quake L', 1500], ['Tremor L', 1000], ['Barrage L', 2000],
      ['X-Large Ancillary Shield Booster', 1], ['Navy Cap Booster 400', 1]
    ]
    assert result & expected
  end

  test "parse EVE hangar text" do
		result = parsed_items(load_data_file('hangar.txt'))
    expected = [
      ['1200mm Artillery Cannon II', 14], ['Ballistic Control System II', 50], ['Coreli A-Type 5MN Microwarpdrive', 4],
      ['Nanite Repair Paste', 7000], ['Scimitar', 2], ['Small Core Defense Field Extender II', 25],
      ['Vexor', 1], ['Warp Disrupt Probe', 370]
    ]
    assert_equal result, expected
  end

	# test "ignores unmatched lines" do
	# 	# Unknown lala
	# 	# [Med slots]
	# end
  #
	# test "be able to parse copy & paste from hangar" do
	# 	# Mid-grade Slave Alpha	1	1.0
	# 	# Mid-grade Slave Beta	1	1.0
	# end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
eve_app-0.1.34 test/eve_app/item_parser_test.rb
eve_app-0.1.33 test/eve_app/item_parser_test.rb
eve_app-0.1.32 test/eve_app/item_parser_test.rb
eve_app-0.1.31 test/eve_app/item_parser_test.rb
eve_app-0.1.29 test/eve_app/item_parser_test.rb
eve_app-0.1.27 test/eve_app/item_parser_test.rb