Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
suejung-sentry committed Oct 3, 2024
1 parent b922568 commit 6fe5eef
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
10 changes: 7 additions & 3 deletions src/services/repo/useRepoBackfilled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ query BackfillFlagMemberships($name: String!, $repo: String!) {

const RepositorySchema = z.object({
__typename: z.literal('Repository'),
flagsMeasurementsActive: z.boolean().nullish(),
flagsMeasurementsBackfilled: z.boolean().nullish(),
flagsCount: z.number().nullish(),
coverageAnalytics: z
.object({
flagsMeasurementsActive: z.boolean().nullish(),
flagsMeasurementsBackfilled: z.boolean().nullish(),
flagsCount: z.number().nullish(),
})
.nullable(),
})

const RepoBackfilledSchema = z.object({
Expand Down
30 changes: 17 additions & 13 deletions src/services/repo/useRepoFlagsSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,23 @@ interface FetchRepoFlagsArgs {

const RepositorySchema = z.object({
__typename: z.literal('Repository'),
flags: z.object({
pageInfo: z.object({
hasNextPage: z.boolean(),
endCursor: z.string().nullable(),
}),
edges: z.array(
z.object({
node: z.object({
name: z.string(),
coverageAnalytics: z
.object({
flags: z.object({
pageInfo: z.object({
hasNextPage: z.boolean(),
endCursor: z.string().nullable(),
}),
})
),
}),
edges: z.array(
z.object({
node: z.object({
name: z.string(),
}),
})
),
}),
})
.nullable(),
})

const FetchRepoFlagsSchema = z.object({
Expand Down Expand Up @@ -157,7 +161,7 @@ function fetchRepoFlags({
} satisfies NetworkErrorObject)
}

const flags = data?.owner?.repository?.flags
const flags = data?.owner?.repository?.coverageAnalytics?.flags
const pageInfo = flags?.pageInfo ?? null

return {
Expand Down

0 comments on commit 6fe5eef

Please sign in to comment.