Skip to content

Commit

Permalink
remove status 200 as it's the default
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-codecov committed Sep 19, 2024
1 parent e25f145 commit 61c44ef
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 59 deletions.
35 changes: 16 additions & 19 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,55 +177,52 @@ describe('App', () => {
server.use(
http.get('/internal/user', (info) => {
if (hasSession) {
return HttpResponse.json(internalUser, { status: 200 })
return HttpResponse.json(internalUser)
} else {
return HttpResponse.json({}, { status: 200 })
return HttpResponse.json({})
}
}),
http.get('/internal/users/current', (info) => {
return HttpResponse.json({}, { status: 200 })
return HttpResponse.json({})
}),
graphql.query('DetailOwner', (info) =>
HttpResponse.json({ data: { owner: 'codecov' } }, { status: 200 })
HttpResponse.json({ data: { owner: 'codecov' } })
),
graphql.query('CurrentUser', (info) => {
if (hasLoggedInUser) {
return HttpResponse.json({ data: user }, { status: 200 })
return HttpResponse.json({ data: user })
}
HttpResponse.json({ data: {} }, { status: 200 })
HttpResponse.json({ data: {} })
}),
graphql.query('GetPlanData', (info) => {
return HttpResponse.json({ data: {} }, { status: 200 })
return HttpResponse.json({ data: {} })
}),
graphql.query('OwnerTier', (info) => {
return HttpResponse.json({ data: {} }, { status: 200 })
return HttpResponse.json({ data: {} })
}),
graphql.query('Seats', (info) => {
return HttpResponse.json({ data: {} }, { status: 200 })
return HttpResponse.json({ data: {} })
}),
graphql.query('HasAdmins', (info) => {
return HttpResponse.json({ data: {} }, { status: 200 })
return HttpResponse.json({ data: {} })
}),
graphql.query('owner', (info) => {
return HttpResponse.json(
{ data: { owner: { isAdmin: true } } },
{ status: 200 }
)
return HttpResponse.json({ data: { owner: { isAdmin: true } } })
}),
graphql.query('MyContexts', (info) => {
return HttpResponse.json({ data: {} }, { status: 200 })
return HttpResponse.json({ data: {} })
}),
graphql.query('GetOktaConfig', (info) => {
return HttpResponse.json({ data: {} }, { status: 200 })
return HttpResponse.json({ data: {} })
}),
graphql.query('OwnerPageData', (info) => {
return HttpResponse.json({ data: {} }, { status: 200 })
return HttpResponse.json({ data: {} })
}),
graphql.mutation('updateDefaultOrganization', (info) => {
return HttpResponse.json({ data: {} }, { status: 200 })
return HttpResponse.json({ data: {} })
}),
graphql.query('GetRepoOverview', (info) => {
return HttpResponse.json({ data: mockRepoOverview }, { status: 200 })
return HttpResponse.json({ data: mockRepoOverview })
})
)
}
Expand Down
37 changes: 17 additions & 20 deletions src/layouts/BaseLayout/BaseLayout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,49 +223,46 @@ describe('BaseLayout', () => {

server.use(
http.get('/internal/user', (info) => {
return HttpResponse.json(internalUser, { status: 200 })
return HttpResponse.json(internalUser)
}),
graphql.query('CurrentUser', (info) => {
return HttpResponse.json({ data: currentUser }, { status: 200 })
return HttpResponse.json({ data: currentUser })
}),
graphql.query('DetailOwner', (info) => {
return HttpResponse.json({ data: mockOwner }, { status: 200 })
return HttpResponse.json({ data: mockOwner })
}),
http.get('/internal/:provider/:owner/account-details', (info) => {
return HttpResponse.json({}, { status: 200 })
return HttpResponse.json({})
}),
// Self hosted only
graphql.query('HasAdmins', (info) => {
return HttpResponse.json({ data: {} }, { status: 200 })
return HttpResponse.json({ data: {} })
}),
graphql.query('Seats', (info) => {
return HttpResponse.json({ data: {} }, { status: 200 })
return HttpResponse.json({ data: {} })
}),
graphql.query('TermsOfService', (info) => {
return HttpResponse.json({ data: {} }, { status: 200 })
return HttpResponse.json({ data: {} })
}),
graphql.query('UseMyOrganizations', (info) => {
return HttpResponse.json(
{
data: {
myOrganizationsData: {
me: {
myOrganizations: {
edges: [],
pageInfo: { hasNextPage: false, endCursor: 'MTI=' },
},
return HttpResponse.json({
data: {
myOrganizationsData: {
me: {
myOrganizations: {
edges: [],
pageInfo: { hasNextPage: false, endCursor: 'MTI=' },
},
},
},
},
{ status: 200 }
)
})
}),
graphql.mutation('updateDefaultOrganization', (info) => {
return HttpResponse.json({ data: {} }, { status: 200 })
return HttpResponse.json({ data: {} })
}),
http.get('/internal/users/current', (info) => {
return HttpResponse.json({}, { status: 200 })
return HttpResponse.json({})
})
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,26 @@ describe('InstallationHelpBanner', () => {

server.use(
graphql.query('IsSyncing', (info) => {
return HttpResponse.json(
{
data: {
me: {
isSyncing: false,
},
return HttpResponse.json({
data: {
me: {
isSyncing: false,
},
},
{ status: 200 }
)
})
}),
graphql.mutation('SyncData', (info) => {
mutation(info.variables)

return HttpResponse.json(
{
data: {
syncWithGitProvider: {
me: {
isSyncing: true,
},
return HttpResponse.json({
data: {
syncWithGitProvider: {
me: {
isSyncing: true,
},
},
},
{ status: 200 }
)
})
})
)

Expand Down
6 changes: 3 additions & 3 deletions src/layouts/BaseLayout/hooks/useUserAccessGate.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,18 @@ describe('useUserAccessGate', () => {

server.use(
http.get('/internal/user', (info) => {
return HttpResponse.json(internalUser, { status: 200 })
return HttpResponse.json(internalUser)
}),

graphql.query('CurrentUser', (info) => {
return HttpResponse.json({ data: user }, { status: 200 })
return HttpResponse.json({ data: user })
}),
graphql.mutation('updateDefaultOrganization', async (info) => {
mockMutationVariables(info.variables)

if (delayMutation) {
await delay(1000)
return HttpResponse.json({}, { status: 200 })
return HttpResponse.json({})
}

return HttpResponse.json({
Expand Down

0 comments on commit 61c44ef

Please sign in to comment.