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