Update flaky test

This commit is contained in:
Ramon Wenger 2022-05-10 21:46:02 +02:00
parent a3099b7d04
commit 637c3994a5
1 changed files with 33 additions and 24 deletions

View File

@ -1,8 +1,19 @@
import {PROJECT_ENTRY_TEMPLATE} from '../../../../src/consts/strings.consts'; import {PROJECT_ENTRY_TEMPLATE} from '../../../../src/consts/strings.consts';
const created = '2021-06-01T11:49:00+00:00';
const createdLater = '2021-06-01T12:49:00+00:00';
const defaultEntries = [
{
id: 'UHJvamVjdEVudHJ5Tm9kZTo2NQ==',
description: 'Aktivität:\nKill Thanos\n\n\nReflexion:\nHe sucks\n\n\nNächste Schritte:\nGo for the head',
documentUrl: '',
created,
},
];
let entries = [...defaultEntries];
describe('Project Page', () => { describe('Project Page', () => {
const created = '2021-06-01T11:49:00+00:00';
const createdLater = '2021-06-01T12:49:00+00:00';
let final = false; let final = false;
const project = { const project = {
@ -19,15 +30,8 @@ describe('Project Page', () => {
id: 'VXNlck5vZGU6NQ==', id: 'VXNlck5vZGU6NQ==',
avatarUrl: '', avatarUrl: '',
}, },
entriesCount: 1, entries,
entries: [ entriesCount: entries.length,
{
id: 'UHJvamVjdEVudHJ5Tm9kZTo2NQ==',
description: 'Aktivität:\nKill Thanos\n\n\nReflexion:\nHe sucks\n\n\nNächste Schritte:\nGo for the head',
documentUrl: '',
created,
},
],
}; };
const operations = { const operations = {
@ -57,22 +61,26 @@ describe('Project Page', () => {
}, },
], ],
}, },
ProjectQuery: { ProjectQuery: () => ({
project, project,
}, }),
DeleteProject: { DeleteProject: {
deleteProject: { deleteProject: {
success: true success: true,
}
},
AddProjectEntry: variables => ({
addProjectEntry: {
projectEntry: Object.assign({}, variables.input.projectEntry, {
created: createdLater,
}),
errors: null,
}, },
}), },
AddProjectEntry: variables => {
const projectEntry = Object.assign({}, variables.input.projectEntry, {
created: createdLater,
});
entries.push(projectEntry);
return {
addProjectEntry: {
projectEntry,
errors: null,
},
};
},
UpdateProjectEntry: variables => ({ UpdateProjectEntry: variables => ({
updateProjectEntry: { updateProjectEntry: {
projectEntry: variables.input.projectEntry, projectEntry: variables.input.projectEntry,
@ -99,6 +107,7 @@ describe('Project Page', () => {
beforeEach(() => { beforeEach(() => {
cy.setup(); cy.setup();
entries = [...defaultEntries];
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations, operations,
@ -164,7 +173,7 @@ describe('Project Page', () => {
MeQuery: { MeQuery: {
me: { me: {
id: 'not-the-same', id: 'not-the-same',
isTeacher: true isTeacher: true,
}, },
}, },
}, },