Skip to content

Commit

Permalink
Fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jayjay-w committed Feb 4, 2025
1 parent bf60055 commit 6366968
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions test/controllers/graphql_controller_2_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -386,22 +386,24 @@ def setup
end

test "should replace blank project media by another" do
u = create_user
t = create_team
create_team_user team: t, user: u, role: 'admin'
old = create_project_media team: t, media: Blank.create!
r = publish_report(old)
new = create_project_media team: t
authenticate_with_user(u)

query = 'mutation { replaceProjectMedia(input: { clientMutationId: "1", project_media_to_be_replaced_id: "' + old.graphql_id + '", new_project_media_id: "' + new.graphql_id + '" }) { old_project_media_deleted_id, new_project_media { dbid } } }'
post :create, params: { query: query, team: t.slug }
assert_response :success
data = JSON.parse(@response.body)['data']['replaceProjectMedia']
assert_equal old.graphql_id, data['old_project_media_deleted_id']
assert_equal new.id, data['new_project_media']['dbid']
assert_nil ProjectMedia.find_by_id(old.id)
assert_equal r, new.get_dynamic_annotation('report_design')
Sidekiq::Testing.inline! do
u = create_user
t = create_team
create_team_user team: t, user: u, role: 'admin'
old = create_project_media team: t, media: Blank.create!
r = publish_report(old)
new = create_project_media team: t
authenticate_with_user(u)

query = 'mutation { replaceProjectMedia(input: { clientMutationId: "1", project_media_to_be_replaced_id: "' + old.graphql_id + '", new_project_media_id: "' + new.graphql_id + '" }) { old_project_media_deleted_id, new_project_media { dbid } } }'
post :create, params: { query: query, team: t.slug }
assert_response :success
data = JSON.parse(@response.body)['data']['replaceProjectMedia']
assert_equal old.graphql_id, data['old_project_media_deleted_id']
assert_equal new.id, data['new_project_media']['dbid']
assert_nil ProjectMedia.find_by_id(old.id)
assert_equal r, new.get_dynamic_annotation('report_design')
end
end

test "should set and get Slack settings for team" do
Expand Down

0 comments on commit 6366968

Please sign in to comment.