Move 'searchUsers' query from mutations to queries, correct and refine test descriptions

This commit is contained in:
Wolfgang Huß 2022-06-02 11:20:58 +02:00
parent 7ee664b8c8
commit ca8ce34f68
3 changed files with 33 additions and 29 deletions

View File

@ -15,14 +15,18 @@ import { garrickOllivander } from '@/seeds/users/garrick-ollivander'
import {
deleteUser,
unDeleteUser,
searchUsers,
createPendingCreation,
createPendingCreations,
updatePendingCreation,
deletePendingCreation,
confirmPendingCreation,
} from '@/seeds/graphql/mutations'
import { getPendingCreations, login, listTransactionLinksAdmin } from '@/seeds/graphql/queries'
import {
getPendingCreations,
login,
searchUsers,
listTransactionLinksAdmin,
} from '@/seeds/graphql/queries'
import { GraphQLError } from 'graphql'
import { User } from '@entity/User'
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
@ -1478,7 +1482,7 @@ describe('AdminResolver', () => {
})
describe('filter with deleted', () => {
it('finds 6 open transaction links and 1 deleted and no redeemed', async () => {
it('finds 6 open transaction links, 1 deleted, and no redeemed', async () => {
await expect(
query({
query: listTransactionLinksAdmin,
@ -1512,7 +1516,7 @@ describe('AdminResolver', () => {
})
describe('filter by expired', () => {
it('finds 6 open transaction links and 1 deleted and no redeemed', async () => {
it('finds 5 open transaction links, 1 expired, and no redeemed', async () => {
await expect(
query({
query: listTransactionLinksAdmin,
@ -1547,7 +1551,7 @@ describe('AdminResolver', () => {
// TODO: works not as expected, because 'redeemedAt' and 'redeemedBy' have to be added to the transaktion link factory
describe.skip('filter by redeemed', () => {
it('finds 6 open transaction links and 1 deleted and no redeemed', async () => {
it('finds 6 open transaction links, 1 deleted, and no redeemed', async () => {
await expect(
query({
query: listTransactionLinksAdmin,

View File

@ -105,30 +105,6 @@ export const unDeleteUser = gql`
}
`
export const searchUsers = gql`
query ($searchText: String!, $currentPage: Int, $pageSize: Int, $filters: SearchUsersFilters) {
searchUsers(
searchText: $searchText
currentPage: $currentPage
pageSize: $pageSize
filters: $filters
) {
userCount
userList {
userId
firstName
lastName
email
creation
emailChecked
hasElopage
emailConfirmationSend
deletedAt
}
}
}
`
export const createPendingCreations = gql`
mutation ($pendingCreations: [CreatePendingCreationArgs!]!) {
createPendingCreations(pendingCreations: $pendingCreations) {

View File

@ -91,6 +91,30 @@ export const sendResetPasswordEmail = gql`
}
`
export const searchUsers = gql`
query ($searchText: String!, $currentPage: Int, $pageSize: Int, $filters: SearchUsersFilters) {
searchUsers(
searchText: $searchText
currentPage: $currentPage
pageSize: $pageSize
filters: $filters
) {
userCount
userList {
userId
firstName
lastName
email
creation
emailChecked
hasElopage
emailConfirmationSend
deletedAt
}
}
}
`
export const listGDTEntriesQuery = gql`
query ($currentPage: Int!, $pageSize: Int!) {
listGDTEntries(currentPage: $currentPage, pageSize: $pageSize) {