kandimat/redaktions-app/src/backend/queries/person.mock.ts

132 lines
2.8 KiB
TypeScript

import { MockedResponse } from "@apollo/client/testing";
import {
GET_PERSONS_SORTED_BY_ROLE,
GetPersonsSortedByRoleResponse,
} from "./person";
export const getPersonsByRoleAllFilledData: GetPersonsSortedByRoleResponse = {
editors: {
nodes: [
{
id: "WyJwZW9wbGUiLDFd",
rowId: 1,
firstName: "Erika",
lastName: "Mustermann",
role: "KANDIMAT_EDITOR",
__typename: "Person",
},
],
__typename: "PeopleConnection",
},
candidates: {
nodes: [
{
id: "WyJwZW9wbGUiLDJd",
rowId: 2,
firstName: "Max",
lastName: "Mustermann",
role: "KANDIMAT_CANDIDATE",
__typename: "Person",
},
{
id: "WyJwZW9wbGUiLDNd",
rowId: 3,
firstName: "Tricia",
lastName: "McMillan",
role: "KANDIMAT_CANDIDATE",
__typename: "Person",
},
],
__typename: "PeopleConnection",
},
users: {
nodes: [
{
id: "WyJwZW9wbGUiLDRd",
rowId: 4,
firstName: "Happy",
lastName: "User",
role: "KANDIMAT_PERSON",
__typename: "Person",
},
],
__typename: "PeopleConnection",
},
};
export const getPersonsSortedByRoleAllFilledMock: Array<
MockedResponse<GetPersonsSortedByRoleResponse>
> = [
{
request: {
query: GET_PERSONS_SORTED_BY_ROLE,
},
result: {
data: getPersonsByRoleAllFilledData,
},
},
];
export const getPersonsByRoleNoCandidatesData: GetPersonsSortedByRoleResponse =
{
editors: {
nodes: [
{
id: "WyJwZW9wbGUiLDFd",
rowId: 1,
firstName: "Erika",
lastName: "Mustermann",
role: "KANDIMAT_EDITOR",
__typename: "Person",
},
],
__typename: "PeopleConnection",
},
candidates: {
nodes: [],
__typename: "PeopleConnection",
},
users: {
nodes: [
{
id: "WyJwZW9wbGUiLDJd",
rowId: 2,
firstName: "Max",
lastName: "Mustermann",
role: "KANDIMAT_PERSON",
__typename: "Person",
},
{
id: "WyJwZW9wbGUiLDNd",
rowId: 3,
firstName: "Tricia",
lastName: "McMillan",
role: "KANDIMAT_PERSON",
__typename: "Person",
},
{
id: "WyJwZW9wbGUiLDRd",
rowId: 4,
firstName: "Happy",
lastName: "User",
role: "KANDIMAT_PERSON",
__typename: "Person",
},
],
__typename: "PeopleConnection",
},
};
export const getPersonsSortedByRoleNoCandidatesMock: Array<
MockedResponse<GetPersonsSortedByRoleResponse>
> = [
{
request: {
query: GET_PERSONS_SORTED_BY_ROLE,
},
result: {
data: getPersonsByRoleNoCandidatesData,
},
},
];