-
Notifications
You must be signed in to change notification settings - Fork 0
Add comprehensive test coverage for failure scenarios in plugin system #29
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
Changes from all commits
3968039
46d89d1
11b8a29
dc4dff4
52f235e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -300,6 +300,19 @@ def error!(message, code) | |||||
end | ||||||
end | ||||||
|
||||||
describe "#safe_json_parse" do | ||||||
it "raises ArgumentError when JSON payload exceeds size limit" do | ||||||
# Test the actual size limit by temporarily setting a small limit | ||||||
stub_const("ENV", ENV.to_h.merge("JSON_MAX_SIZE" => "10")) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] Stubbing the entire
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
|
||||||
large_json = '{"data": "' + "x" * 20 + '"}' | ||||||
|
||||||
expect { | ||||||
helper.send(:safe_json_parse, large_json) | ||||||
}.to raise_error(ArgumentError, "JSON payload too large for parsing") | ||||||
end | ||||||
end | ||||||
|
||||||
describe "#determine_error_code" do | ||||||
it "returns 400 for ArgumentError" do | ||||||
error = ArgumentError.new("bad argument") | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The same rescue/raise pattern is duplicated across multiple plugin-loading methods. Consider extracting this into a helper (e.g.
handle_load_error(file_path, &block)
) to reduce duplication and make future changes easier.Copilot uses AI. Check for mistakes.