mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 18:56:05 +02:00
Use Estonian reference number format instead of ISO 11649
This commit is contained in:
parent
aa6e8f8a93
commit
5738c17731
25 changed files with 244 additions and 47 deletions
29
test/models/billing/reference_no/base_test.rb
Normal file
29
test/models/billing/reference_no/base_test.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
require 'test_helper'
|
||||
|
||||
# https://www.pangaliit.ee/settlements-and-standards/reference-number-of-the-invoice
|
||||
class ReferenceNoBaseTest < ActiveSupport::TestCase
|
||||
def test_generates_random_base
|
||||
assert_not_equal Billing::ReferenceNo::Base.generate, Billing::ReferenceNo::Base.generate
|
||||
end
|
||||
|
||||
def test_randomly_generated_base_conforms_to_standard
|
||||
base = Billing::ReferenceNo::Base.generate
|
||||
format = /\A\d{1,19}\z/
|
||||
assert_match format, base.to_s
|
||||
end
|
||||
|
||||
def test_generates_check_digit_for_a_given_base
|
||||
assert_equal 3, Billing::ReferenceNo::Base.new('1').check_digit
|
||||
assert_equal 7, Billing::ReferenceNo::Base.new('1234567891234567891').check_digit
|
||||
end
|
||||
|
||||
def test_returns_string_representation
|
||||
base = Billing::ReferenceNo::Base.new('1')
|
||||
assert_equal '1', base.to_s
|
||||
end
|
||||
|
||||
def test_normalizes_non_string_values
|
||||
base = Billing::ReferenceNo::Base.new(1)
|
||||
assert_equal '1', base.to_s
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue