From 49356c00c10a2a5d86e3c4c470dcc9966b8694d3 Mon Sep 17 00:00:00 2001 From: kao Date: Thu, 15 Jun 2023 09:24:04 -0700 Subject: [PATCH] New test for userTickByClimb --- src/__tests__/ticks.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/__tests__/ticks.ts b/src/__tests__/ticks.ts index 728a25e4..caafdf38 100644 --- a/src/__tests__/ticks.ts +++ b/src/__tests__/ticks.ts @@ -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 = { @@ -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', () => {