Skip to content

Commit

Permalink
common, docs: fix ActionInput schema
Browse files Browse the repository at this point in the history
`reason` and `priority` fields are mandatory.
  • Loading branch information
tilacog committed Mar 14, 2023
1 parent 0ed20f2 commit 1c0004f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions docs/action-queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ input ActionInput {
poi: String
force: Boolean
source: String!
reason: String
priority: Int
reason: String!
priority: Int!
}

input ActionUpdateInput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,24 +655,24 @@ describe('Actions', () => {
})

test('Reject empty action input', async () => {
const expectedFieldNamesAndTypes: [string, string][] = [
['status', 'ActionStatus'],
['type', 'ActionType'],
['source', 'String'],
['reason', 'String'],
['priority', 'Int'],
]
const graphQLErrors = expectedFieldNamesAndTypes.map(
([fieldName, fieldType]) =>
new GraphQLError(
`Variable "$actions" got invalid value {} at "actions[0]"; Field "${fieldName}" of required type "${fieldType}!" was not provided.`,
),
)
const expected = new CombinedError({ graphQLErrors })

await expect(
client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [{}] }).toPromise(),
).resolves.toHaveProperty(
'error',
new CombinedError({
graphQLErrors: [
new GraphQLError(
'Variable "$actions" got invalid value {} at "actions[0]"; Field "status" of required type "ActionStatus!" was not provided.',
),
new GraphQLError(
'Variable "$actions" got invalid value {} at "actions[0]"; Field "type" of required type "ActionType!" was not provided.',
),
new GraphQLError(
'Variable "$actions" got invalid value {} at "actions[0]"; Field "source" of required type "String!" was not provided.',
),
],
}),
)
).resolves.toHaveProperty('error', expected)
})

test('Reject action with invalid params for action type', async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/indexer-common/src/indexer-management/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ const SCHEMA_SDL = gql`
poi: String
force: Boolean
source: String!
reason: String
priority: Int
reason: String!
priority: Int!
}
input ActionUpdateInput {
Expand Down

0 comments on commit 1c0004f

Please sign in to comment.