Skip to content

Commit

Permalink
Add default value to Context::scope parameter to make it optional
Browse files Browse the repository at this point in the history
  • Loading branch information
zzooeeyy committed Oct 4, 2024
1 parent dbf36b7 commit 1be3837
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/shopify_api/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class << self
api_key: String,
api_secret_key: String,
api_version: String,
scope: T.any(T::Array[String], String),
is_private: T::Boolean,
is_embedded: T::Boolean,
scope: T.any(T::Array[String], String),
log_level: T.any(String, Symbol),
logger: T.untyped,
host_name: T.nilable(String),
Expand All @@ -51,9 +51,9 @@ def setup(
api_key:,
api_secret_key:,
api_version:,
scope:,
is_private:,
is_embedded:,
scope: [],
log_level: :info,
logger: ::Logger.new($stdout),
host_name: nil,
Expand Down
13 changes: 13 additions & 0 deletions test/context_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,19 @@ def test_send_a_warning_if_log_level_is_invalid
)
end

def test_scope_config_can_be_optional_and_defaults_to_empty
ShopifyAPI::Context.setup(
api_key: "",
api_secret_key: "",
api_version: "2023-10",
host_name: "",
is_private: false,
is_embedded: true,
)

assert_equal(ShopifyAPI::Auth::AuthScopes.new, ShopifyAPI::Context.scope)
end

def teardown
ShopifyAPI::Context.deactivate_session
end
Expand Down

0 comments on commit 1be3837

Please sign in to comment.