Skip to content

Commit

Permalink
removed failed tests from preventing users from access to the app
Browse files Browse the repository at this point in the history
  • Loading branch information
goodeats committed May 23, 2024
1 parent c97cb1d commit 85c5cef
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
16 changes: 8 additions & 8 deletions app/routes/_auth+/auth.$provider.callback.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ afterEach(async () => {
await deleteGitHubUsers()
})

test('a new user goes to onboarding', async () => {
test.skip('a new user goes to onboarding', async () => {
const request = await setupRequest()
const response = await loader({ request, params: PARAMS, context: {} }).catch(
e => e,
)
expect(response).toHaveRedirect('/onboarding/github')
})

test('when auth fails, send the user to login with a toast', async () => {
test.skip('when auth fails, send the user to login with a toast', async () => {
consoleError.mockImplementation(() => {})
server.use(
http.post('https://github.com/login/oauth/access_token', async () => {
Expand All @@ -53,7 +53,7 @@ test('when auth fails, send the user to login with a toast', async () => {
expect(consoleError).toHaveBeenCalledTimes(1)
})

test('when a user is logged in, it creates the connection', async () => {
test.skip('when a user is logged in, it creates the connection', async () => {
const githubUser = await insertGitHubUser()
const session = await setupUser()
const request = await setupRequest({
Expand Down Expand Up @@ -82,7 +82,7 @@ test('when a user is logged in, it creates the connection', async () => {
).toBeTruthy()
})

test(`when a user is logged in and has already connected, it doesn't do anything and just redirects the user back to the connections page`, async () => {
test.skip(`when a user is logged in and has already connected, it doesn't do anything and just redirects the user back to the connections page`, async () => {
const session = await setupUser()
const githubUser = await insertGitHubUser()
await prisma.connection.create({
Expand All @@ -106,7 +106,7 @@ test(`when a user is logged in and has already connected, it doesn't do anything
)
})

test('when a user exists with the same email, create connection and make session', async () => {
test.skip('when a user exists with the same email, create connection and make session', async () => {
const githubUser = await insertGitHubUser()
const email = githubUser.primaryEmail.toLowerCase()
const { userId } = await setupUser({ ...createUser(), email })
Expand Down Expand Up @@ -137,7 +137,7 @@ test('when a user exists with the same email, create connection and make session
await expect(response).toHaveSessionForUser(userId)
})

test('gives an error if the account is already connected to another user', async () => {
test.skip('gives an error if the account is already connected to another user', async () => {
const githubUser = await insertGitHubUser()
await prisma.user.create({
data: {
Expand Down Expand Up @@ -167,7 +167,7 @@ test('gives an error if the account is already connected to another user', async
)
})

test('if a user is not logged in, but the connection exists, make a session', async () => {
test.skip('if a user is not logged in, but the connection exists, make a session', async () => {
const githubUser = await insertGitHubUser()
const { userId } = await setupUser()
await prisma.connection.create({
Expand All @@ -183,7 +183,7 @@ test('if a user is not logged in, but the connection exists, make a session', as
await expect(response).toHaveSessionForUser(userId)
})

test('if a user is not logged in, but the connection exists and they have enabled 2FA, send them to verify their 2FA and do not make a session', async () => {
test.skip('if a user is not logged in, but the connection exists and they have enabled 2FA, send them to verify their 2FA and do not make a session', async () => {
const githubUser = await insertGitHubUser()
const { userId } = await setupUser()
await prisma.connection.create({
Expand Down
4 changes: 2 additions & 2 deletions app/routes/users+/$username.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { authSessionStorage } from '#app/utils/session.server.ts'
import { createUser, getUserImages } from '#tests/db-utils.ts'
import { default as UsernameRoute, loader } from './$username.tsx'

test('The user profile when not logged in as self', async () => {
test.skip('The user profile when not logged in as self', async () => {
const userImages = await getUserImages()
const userImage =
userImages[faker.number.int({ min: 0, max: userImages.length - 1 })]
Expand All @@ -37,7 +37,7 @@ test('The user profile when not logged in as self', async () => {
await screen.findByRole('link', { name: `${user.name}'s notes` })
})

test('The user profile when logged in as self', async () => {
test.skip('The user profile when logged in as self', async () => {
const userImages = await getUserImages()
const userImage =
userImages[faker.number.int({ min: 0, max: userImages.length - 1 })]
Expand Down
27 changes: 25 additions & 2 deletions tests/e2e/onboarding.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,27 @@ const test = base.extend<{
},
})

test('onboarding with link', async ({ page, getOnboardingData }) => {
test('onboarding not allowed', async ({ page, login }) => {
await page.goto('/')

// no login link
const loginLink = page.getByRole('link', { name: /log in/i })
await expect(loginLink).not.toBeVisible()

await page.goto('/login')

// no create account link
const createAccountLink = page.getByRole('link', {
name: /create an account/i,
})
await expect(createAccountLink).not.toBeVisible()

// signup page redirects to home
await page.goto('/signup')
await expect(page).toHaveURL(`/`)
})

test.skip('onboarding with link', async ({ page, getOnboardingData }) => {
const onboardingData = getOnboardingData()

await page.goto('/')
Expand Down Expand Up @@ -104,7 +124,10 @@ test('onboarding with link', async ({ page, getOnboardingData }) => {
await expect(page).toHaveURL(`/`)
})

test('onboarding with a short code', async ({ page, getOnboardingData }) => {
test.skip('onboarding with a short code', async ({
page,
getOnboardingData,
}) => {
const onboardingData = getOnboardingData()

await page.goto('/signup')
Expand Down

0 comments on commit 85c5cef

Please sign in to comment.