Skip to content

Commit

Permalink
New test for userTickByClimb
Browse files Browse the repository at this point in the history
  • Loading branch information
zichongkao committed Jun 15, 2023
1 parent 9e3318e commit 49356c0
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/__tests__/ticks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ describe('ticks API', () => {
}
}
`
const userTickByClimbQuery = `
query userTicksByClimbId($userId: String, $climbId: String) {
userTicksByClimbId(userId: $userId, climbId: $climbId) {
_id
name
notes
climbId
style
attemptType
dateClimbed
grade
userId
}
}
`

it('queries by userId', async () => {
const userProfileInput: UpdateProfileGQLInput = {
Expand Down Expand Up @@ -104,6 +119,19 @@ describe('ticks API', () => {
expect(res).toHaveLength(1)
expect(res[0].name).toBe(tickOne.name)
})

it('queries by userId and climbId', async () => {
await ticks.addTick(tickOne)
const response = await queryAPI({
query: userTickByClimbQuery,
variables: { userId: userUuid, climbId: tickOne.climbId },
userUuid
})
expect(response.statusCode).toBe(200)
const res = response.body.data.userTicksByClimbId
expect(res).toHaveLength(1)
expect(res[0].name).toBe(tickOne.name)
})
})

describe('mutations', () => {
Expand Down

0 comments on commit 49356c0

Please sign in to comment.