application_credit_test.rb 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # frozen_string_literal: true
  2. require 'test_helper'
  3. class ApplicationCreditTest < Test::Unit::TestCase
  4. def test_application_credit_create
  5. fake("application_credits", method: :post, status: 201, body: load_fixture('application_credit'))
  6. credit = ShopifyAPI::ApplicationCredit.create(
  7. description: "refund for application charge",
  8. amount: 5.00,
  9. api_client_id: 861378,
  10. shop_id: 487168
  11. )
  12. assert_equal('refund for application charge', credit.description)
  13. assert_equal('5.00', credit.amount)
  14. end
  15. def test_get_application_credit
  16. fake("application_credits/803742", method: :get, status: 201, body: load_fixture('application_credit'))
  17. credit = ShopifyAPI::ApplicationCredit.find(803742)
  18. assert_equal('refund for application charge', credit.description)
  19. assert_equal('5.00', credit.amount)
  20. end
  21. def test_list_application_credits
  22. fake("application_credits", method: :get, status: 201, body: load_fixture('application_credits'))
  23. credit = ShopifyAPI::ApplicationCredit.find(:all)
  24. assert_equal(2, credit.size)
  25. assert_equal('10.00', credit.last.amount)
  26. end
  27. end