Sha256: 2f2ea7849a00adbd8619afe17154cc8807165b77533b2aa6e6fada8b6a9f7b5b

Contents?: true

Size: 1.07 KB

Versions: 15

Compression:

Stored size: 1.07 KB

Contents

require 'test_helper'

class UtilsTest < ActiveSupport::TestCase

  setup do
    ShopifyApp.configuration = nil
  end

  ['my-shop', 'my-shop.myshopify.com', 'https://my-shop.myshopify.com', 'http://my-shop.myshopify.com'].each do |good_url|
    test "sanitize_shop_domain for (#{good_url})" do
      ShopifyApp.configuration.embedded_app = true
      assert ShopifyApp::Utils.sanitize_shop_domain(good_url)
    end
  end

  ['my-shop', 'my-shop.myshopify.io', 'https://my-shop.myshopify.io', 'http://my-shop.myshopify.io'].each do |good_url|
    test "sanitize_shop_domain URL (#{good_url}) with custom myshopify_domain" do
      ShopifyApp.configuration.embedded_app = true
      ShopifyApp.configuration.myshopify_domain = 'myshopify.io'
      assert ShopifyApp::Utils.sanitize_shop_domain(good_url)
    end
  end

  ['myshop.com', 'myshopify.com', 'shopify.com', 'two words', 'store.myshopify.com.evil.com', '/foo/bar'].each do |bad_url|
    test "sanitize_shop_domain for a non-myshopify URL (#{bad_url})" do
      assert_nil ShopifyApp::Utils.sanitize_shop_domain(bad_url)
    end
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
shopify_app-6.4.2 test/shopify_app/utils_test.rb
shopify_app-6.4.1 test/shopify_app/utils_test.rb
shopify_app-6.4.0 test/shopify_app/utils_test.rb
shopify_app-6.3.0 test/shopify_app/utils_test.rb
shopify_app-6.2.1 test/shopify_app/utils_test.rb
shopify_app-6.2.0 test/shopify_app/utils_test.rb
shopify_app-6.1.3 test/shopify_app/utils_test.rb
shopify_app-6.1.2 test/shopify_app/utils_test.rb
shopify_app-6.1.1 test/shopify_app/utils_test.rb
shopify_app-6.1.0 test/shopify_app/utils_test.rb
shopify_app-6.0.6 test/shopify_app/utils_test.rb
shopify_app-6.0.5 test/shopify_app/utils_test.rb
shopify_app-6.0.4 test/shopify_app/utils_test.rb
shopify_app-6.0.3 test/shopify_app/utils_test.rb
shopify_app-6.0.2 test/shopify_app/utils_test.rb