Skip to content

Commit

Permalink
Add test for decode_prefix_id
Browse files Browse the repository at this point in the history
  • Loading branch information
namolnad committed Nov 21, 2024
1 parent a980089 commit 7df43b0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/prefixed_ids_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,16 @@ class PrefixedIdsTest < ActiveSupport::TestCase
assert_nil Post.new.to_param
end

test "can retrieve a decoded ID from a prefixed ID" do
team = teams(:one)
assert_equal PrefixedIds.decode_prefix_id(team.id), team.id
end

test "decoded id returns actual id if passed a non-prefix_id" do
user = users(:one)
assert_equal PrefixedIds.decode_prefix_id(user.id), user.id
end

if PrefixedIds::Test.rails71_and_up?
test "compound primary - can get prefix ID from original ID" do
assert compound_primary_items(:one).id.is_a?(Array)
Expand Down

0 comments on commit 7df43b0

Please sign in to comment.