Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning assert_equal with a nil value in it since it's going to f… #122

Merged
merged 1 commit into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions test/whatsapp/api/phone_numbers_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def invalid_register_number_response
"message" => "(#100) Param pin must be 6 characters long.",
"type" => "OAuthException",
"code" => 100,
"error_subcode" => 22,
"fbtrace_id" => "AVU2ojfLmjKZSKbkWqjA_Uc"
}
}
Expand Down Expand Up @@ -221,21 +222,29 @@ def assert_phone_number_mock_response(expected_phone_number, response)
end

def assert_phone_number(expected_phone_number, phone_number)
assert_equal(expected_phone_number["id"], phone_number.id)
assert_equal(expected_phone_number["display_phone_number"], phone_number.display_phone_number)
assert_equal(expected_phone_number["quality_rating"], phone_number.quality_rating)
assert_equal(expected_phone_number["verified_name"], phone_number.verified_name)
assert_equal(expected_phone_number["code_verification_status"], phone_number.code_verification_status)
assert_equal(expected_phone_number["is_official_business_account"], phone_number.is_official_business_account)
assert_equal(expected_phone_number["account_mode"], phone_number.account_mode)
assert_equal(expected_phone_number["eligibility_for_api_business_global_search"],
phone_number.eligibility_for_api_business_global_search)
assert_equal(expected_phone_number["is_pin_enabled"], phone_number.is_pin_enabled)
assert_equal(expected_phone_number["name_status"], phone_number.name_status)
assert_equal(expected_phone_number["new_name_status"], phone_number.new_name_status)
assert_equal(expected_phone_number["status"], phone_number.status)
assert_equal(expected_phone_number["search_visibility"], phone_number.search_visibility)
assert_equal(expected_phone_number["certificate"], phone_number.certificate)
[
[expected_phone_number["id"], phone_number.id],
[expected_phone_number["display_phone_number"], phone_number.display_phone_number],
[expected_phone_number["quality_rating"], phone_number.quality_rating],
[expected_phone_number["verified_name"], phone_number.verified_name],
[expected_phone_number["code_verification_status"], phone_number.code_verification_status],
[expected_phone_number["is_official_business_account"], phone_number.is_official_business_account],
[expected_phone_number["account_mode"], phone_number.account_mode],
[expected_phone_number["eligibility_for_api_business_global_search"],
phone_number.eligibility_for_api_business_global_search],
[expected_phone_number["is_pin_enabled"], phone_number.is_pin_enabled],
[expected_phone_number["name_status"], phone_number.name_status],
[expected_phone_number["new_name_status"], phone_number.new_name_status],
[expected_phone_number["status"], phone_number.status],
[expected_phone_number["search_visibility"], phone_number.search_visibility],
[expected_phone_number["certificate"], phone_number.certificate]
].each do |expected, actual|
if expected.nil?
assert_nil(actual)
else
assert_equal(expected, actual)
end
end
end
end
end
Expand Down
22 changes: 15 additions & 7 deletions test/whatsapp/api/templates_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,21 @@ def mock_response
end

def assert_templates_mock_response(expected_template_response, template_response)
assert_equal(Responses::TemplateDataResponse, template_response.class)
assert_equal(expected_template_response["id"], template_response.template.id)
assert_equal(expected_template_response["status"], template_response.template.status.serialize)
assert_equal(expected_template_response["category"], template_response.template.category.serialize)
assert_equal(expected_template_response["language"], template_response.template.language)
assert_equal(expected_template_response["name"], template_response.template.name)
assert_equal(expected_template_response["components"], template_response.template.components_json)
[
[Responses::TemplateDataResponse, template_response.class],
[expected_template_response["id"], template_response.template.id],
[expected_template_response["status"], template_response.template.status.serialize],
[expected_template_response["category"], template_response.template.category.serialize],
[expected_template_response["language"], template_response.template.language],
[expected_template_response["name"], template_response.template.name],
[expected_template_response["components"], template_response.template.components_json]
].each do |expected, actual|
if expected.nil?
assert_nil(actual)
else
assert_equal(expected, actual)
end
end
end

def assert_ok_response(response)
Expand Down
Loading