Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antopalidi committed Sep 8, 2024
1 parent be09866 commit 0f51d17
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
9 changes: 6 additions & 3 deletions decidim-budgets/spec/types/budget_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ module Budgets
let(:query) { "{ projects { id } }" }

it "returns the budget projects" do
ids = response["projects"].map { |project| project["id"] }
expect(ids).to include(*model.projects.map(&:id).map(&:to_s))
expect(ids).not_to include(*budget2.projects.map(&:id).map(&:to_s))
ids = response["projects"].map { |project| project["id"].to_s }
model_project_ids = model.projects.map(&:id).map(&:to_s)
budget2_project_ids = budget2.projects.map(&:id).map(&:to_s)

expect(ids).to match_array(model_project_ids)
expect(ids & budget2_project_ids).to be_empty
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

it "returns the endorsements this query has received" do
endorsement_names = response["endorsements"].map { |endorsement| endorsement["name"] }
expect(endorsement_names).to include(*model.endorsements.map(&:author).map(&:name))
expected_names = model.endorsements.map(&:author).map(&:name)

expect(endorsement_names).to match_array(expected_names)
end
end
end
4 changes: 2 additions & 2 deletions decidim-initiatives/spec/types/initiative_api_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ module Initiatives
let(:initiatives) { create_list(:initiative, initiatives_type: model, organization: :current_organization) }

it "returns the initiatives" do
ids = response["initiatives"].map { |item| item["id"] }
expect(ids).to include(*model.initiatives.map(&:id).map(&:to_s))
ids = response["initiatives"].map { |item| item["id"].to_s }
expect(ids).to match_array(model.initiatives.map(&:id).map(&:to_s))
end
end
end
Expand Down

0 comments on commit 0f51d17

Please sign in to comment.