1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
# frozen_string_literal: true
require_relative 'helper'
class TestAddressAU < Test::Unit::TestCase
include DeterministicHelper
assert_methods_are_deterministic(
FFaker::AddressAU,
:state, :state_abbr, :suburb, :postcode, :full_address
)
def test_au_state_abbr_insertion
FFaker::AddressAU::STATE_ABBR.sort
assert FFaker::AddressAU::SUBURB.keys.sort
assert FFaker::AddressAU::POSTCODE.keys.sort
end
def test_au_state
assert_match(/[ a-z]/, FFaker::AddressAU.state)
end
def test_au_state_abbr
assert_match(/[A-Z]/, FFaker::AddressAU.state_abbr)
end
def test_au_suburb
assert_match(/[a-zA-Z]/, FFaker::AddressAU.suburb)
end
def test_postcode
assert_match(/\d{4}/, FFaker::AddressAU.postcode)
end
def test_full_address
assert_match(/[, a-z]/, FFaker::AddressAU.full_address)
end
def test_au_suburb_with_states
FFaker::AddressAU::STATE_ABBR.each do |st_abbr|
assert_match(/[a-zA-Z]/, FFaker::AddressAU.suburb(st_abbr))
assert_deterministic { FFaker::AddressAU.suburb(st_abbr) }
end
end
def test_au_suburb_with_state_and_postcodes
FFaker::AddressAU::STATE_ABBR.each do |st_abbr|
p_code = FFaker::AddressAU.postcode(st_abbr)
assert_match(/[a-zA-Z]/, FFaker::AddressAU.suburb(st_abbr, p_code))
assert_deterministic { FFaker::AddressAU.suburb(st_abbr, p_code) }
end
end
def test_postcode_with_states
FFaker::AddressAU::STATE_ABBR.each do |st_abbr|
assert_match(/\d{4}/, FFaker::AddressAU.postcode(st_abbr))
assert_deterministic { FFaker::AddressAU.postcode(st_abbr) }
end
end
def test_full_address_with_states
FFaker::AddressAU::STATE_ABBR.each do |st_abbr|
assert_match(/[, a-z]/, FFaker::AddressAU.full_address(st_abbr))
assert_deterministic { FFaker::AddressAU.full_address(st_abbr) }
end
end
def test_time_zone
assert_includes(FFaker::AddressAU::TIME_ZONE.values, FFaker::AddressAU.time_zone)
end
def test_time_zone_with_states
FFaker::AddressAU::STATE_ABBR.each do |st_abbr|
assert_includes(FFaker::AddressAU::TIME_ZONE.values, FFaker::AddressAU.time_zone)
assert_deterministic { FFaker::AddressAU.postcode(st_abbr) }
end
end
end
|