Sha256: c94ed6e76553db6d1f9a8c186a834ec25c4e02945932a9adf9478fb78c05f800

Contents?: true

Size: 1.86 KB

Versions: 5

Compression:

Stored size: 1.86 KB

Contents

# frozen_string_literal: true

require_relative 'helper'

class TestPhoneNumberAU < Test::Unit::TestCase
  include DeterministicHelper

  assert_methods_are_deterministic(
    FFaker::PhoneNumberAU,
    :mobile_phone_prefix, :home_work_phone_prefix, :phone_prefix,
    :mobile_phone_number, :home_work_phone_number, :phone_number,
    :international_mobile_phone_number,
    :international_home_work_phone_number,
    :international_phone_number
  )

  def setup
    @tester = FFaker::PhoneNumberAU
  end

  def test_mobile_phone_prefix
    assert_include(FFaker::PhoneNumberAU::MOBILE_OPERATORS_PREFIX,
                   @tester.mobile_phone_prefix)
  end

  def test_home_work_phone_prefix
    assert_include(FFaker::PhoneNumberAU::HOME_WORK_OPERATORS_PREFIX,
                   @tester.home_work_phone_prefix)
  end

  def test_phone_prefix
    assert_include(FFaker::PhoneNumberAU::OPERATORS_PREFIX,
                   @tester.phone_prefix)
  end

  def test_mobile_phone_number
    assert_match(/0[45]\d{2} \d{3} \d{3}/,
                 FFaker::PhoneNumberAU.mobile_phone_number)
  end

  def test_home_work_phone_number
    assert_match(/\(\d{2}\) \d{4} \d{4}/,
                 FFaker::PhoneNumberAU.home_work_phone_number)
  end

  def test_phone_number
    assert_match(/(?:0[45]\d{1,2} \d{3} \d{3}|\(\d{2}\) \d{4} \d{4})/,
                 FFaker::PhoneNumberAU.phone_number)
  end

  def test_international_mobile_phone_number
    assert_match(/\+61 \d{1,2} \d{4} \d{4}/,
                 FFaker::PhoneNumberAU.international_mobile_phone_number)
  end

  def test_international_home_work_phone_number
    assert_match(/\+61 \d{1,2} \d{4} \d{4}/,
                 FFaker::PhoneNumberAU.international_home_work_phone_number)
  end

  def test_international_phone_number
    assert_match(/\+61 \d{1,2} \d{4} \d{4}/,
                 FFaker::PhoneNumberAU.international_phone_number)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ffaker-2.23.0 test/test_phone_number_au.rb
ffaker-2.22.0 test/test_phone_number_au.rb
ffaker-2.21.0 test/test_phone_number_au.rb
ffaker-2.20.0 test/test_phone_number_au.rb
ffaker-2.19.0 test/test_phone_number_au.rb