Skip to content

Commit

Permalink
fix: e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
beeman committed Mar 17, 2024
1 parent 9ed3961 commit 92426b0
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions apps/api-e2e/src/api/api-user-feature.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
AdminCreateUserInput,
AdminFindManyUserInput,
AdminUpdateUserInput,
User,
UserAdminCreateInput,
UserAdminFindManyInput,
UserAdminUpdateInput,
UserRole,
UserStatus,
} from '@pubkey-program-sandbox/sdk'
Expand All @@ -22,7 +22,7 @@ describe('api-user-feature', () => {
})

it('should create a user', async () => {
const input: AdminCreateUserInput = {
const input: UserAdminCreateInput = {
username: uniqueId('user'),
password: uniqueId('pass'),
}
Expand All @@ -42,13 +42,13 @@ describe('api-user-feature', () => {
})

it('should update a user', async () => {
const createInput: AdminCreateUserInput = {
const createInput: UserAdminCreateInput = {
username: uniqueId('user'),
password: uniqueId('pass'),
}
const createdRes = await sdk.adminCreateUser({ input: createInput }, { cookie })
const userId = createdRes.data.created.id
const input: AdminUpdateUserInput = {
const input: UserAdminUpdateInput = {
avatarUrl: avatarUrl(createdRes.data.created.username),
name: 'John Doe',
role: UserRole.Admin,
Expand All @@ -65,15 +65,15 @@ describe('api-user-feature', () => {
})

it('should not update a user with an existing name', async () => {
const createInput: AdminCreateUserInput = {
const createInput: UserAdminCreateInput = {
username: uniqueId('user'),
password: uniqueId('pass'),
}
const createdRes = await sdk.adminCreateUser({ input: createInput }, { cookie })
const userId = createdRes.data.created.id
expect.assertions(1)

const input: AdminUpdateUserInput = {
const input: UserAdminUpdateInput = {
username: 'alice',
}
try {
Expand All @@ -84,14 +84,14 @@ describe('api-user-feature', () => {
})

it('should find a list of users (find all)', async () => {
const createInput: AdminCreateUserInput = {
const createInput: UserAdminCreateInput = {
username: uniqueId('user'),
password: uniqueId('pass'),
}
const createdRes = await sdk.adminCreateUser({ input: createInput }, { cookie })
const userId = createdRes.data.created.id

const input: AdminFindManyUserInput = {}
const input: UserAdminFindManyInput = {}

const res = await sdk.adminFindManyUser({ input }, { cookie })

Expand All @@ -102,14 +102,14 @@ describe('api-user-feature', () => {
})

it('should find a list of users (find new one)', async () => {
const createInput: AdminCreateUserInput = {
const createInput: UserAdminCreateInput = {
username: uniqueId('user'),
password: uniqueId('pass'),
}
const createdRes = await sdk.adminCreateUser({ input: createInput }, { cookie })
const userId = createdRes.data.created.id

const input: AdminFindManyUserInput = {
const input: UserAdminFindManyInput = {
search: userId,
}

Expand All @@ -121,7 +121,7 @@ describe('api-user-feature', () => {
})

it('should find a user by id', async () => {
const createInput: AdminCreateUserInput = {
const createInput: UserAdminCreateInput = {
username: uniqueId('user'),
password: uniqueId('pass'),
}
Expand All @@ -134,7 +134,7 @@ describe('api-user-feature', () => {
})

it('should delete a user', async () => {
const createInput: AdminCreateUserInput = {
const createInput: UserAdminCreateInput = {
username: uniqueId('user'),
password: uniqueId('pass'),
}
Expand All @@ -159,7 +159,7 @@ describe('api-user-feature', () => {

it('should not create a user', async () => {
expect.assertions(1)
const input: AdminCreateUserInput = {
const input: UserAdminCreateInput = {
username: uniqueId('user'),
password: uniqueId('pass'),
}
Expand Down

0 comments on commit 92426b0

Please sign in to comment.