Skip to content

Commit

Permalink
CV2-4072: test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
melsawy committed Jan 30, 2024
1 parent 16ca86d commit 4236be7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/graph/types/bot_user_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def settings_as_json_schema(team_slug: nil)
object.settings_as_json_schema(false, team_slug)
end

field :team_author, TeamType, null: true
field :team_author, PublicTeamType, null: true

def team_author
RecordLoader.for(Team).load(object.team_author_id.to_i)
Expand Down
2 changes: 2 additions & 0 deletions app/lib/check_graphql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def object_from_id(id, ctx)
if type_name == 'About'
name = Rails.application.class.module_parent_name
obj = OpenStruct.new({ name: name, version: VERSION, id: 1, type: 'About' })
elsif type_name == 'Me'
obj = User.find_if_can(id)
elsif ['Relationships', 'RelationshipsSource', 'RelationshipsTarget'].include?(type_name)
obj = ProjectMedia.find_if_can(id)
elsif type_name == 'CheckSearch'
Expand Down
2 changes: 1 addition & 1 deletion lib/relay.idl
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ type BotUser implements Node {
permissions: String
settings_as_json_schema(team_slug: String): String
settings_ui_schema: String
team_author: Team
team_author: PublicTeam
updated_at: String
}

Expand Down
2 changes: 1 addition & 1 deletion public/relay.json
Original file line number Diff line number Diff line change
Expand Up @@ -2328,7 +2328,7 @@
],
"type": {
"kind": "OBJECT",
"name": "Team",
"name": "PublicTeam",
"ofType": null
},
"isDeprecated": false,
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/graphql_controller_2_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def setup
authenticate_with_user
tb1 = create_team_bot set_listed: true
tb2 = create_team_bot set_listed: false
query = "query read { root { current_user { id }, current_team { id }, team_bots_listed { edges { node { dbid } } } } }"
query = "query read { root { current_user { id }, current_team { id }, team_bots_listed { edges { node { dbid, get_description, get_version, get_source_code_url, get_role } } } } }"
post :create, params: { query: query }
edges = JSON.parse(@response.body)['data']['root']['team_bots_listed']['edges']
assert_equal [tb1.id], edges.collect{ |e| e['node']['dbid'] }
Expand Down

0 comments on commit 4236be7

Please sign in to comment.