Skip to content

Commit

Permalink
feat(storage): do not generate search wildcard
Browse files Browse the repository at this point in the history
  • Loading branch information
joseivanlopez committed Oct 30, 2024
1 parent aa2bb2c commit 240a885
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ def self.config_type
Configs::Search
end

# @see Base#convert
def convert
return SEARCH_ANYTHING_STRING if config.all_if_any?

super
end

private

# @see Base#conversions
Expand Down
7 changes: 0 additions & 7 deletions service/lib/agama/storage/configs/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ def always_match?
name.nil?
end

# Whether the search matches all the available devices, skipping if none is found
#
# @return [Boolean]
def all_if_any?
always_match? && max.nil? && if_not_found == :skip
end

# Whether the section containing the search should be skipped
#
# @return [Boolean]
Expand Down
8 changes: 6 additions & 2 deletions service/test/agama/storage/config_conversions/to_json_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,15 @@
context "if there are no conditions or limits and errors should be skipped" do
let(:search) { { ifNotFound: "skip" } }

it "generates a wildcard" do
it "generates the expected JSON" do
config_json = result_scope.call(subject.convert)
search_json = config_json[:search]

expect(search_json).to eq "*"
expect(search_json).to eq(
{
ifNotFound: "skip"
}
)
end
end
end
Expand Down

0 comments on commit 240a885

Please sign in to comment.