Fix another cypress test

This commit is contained in:
Ramon Wenger 2022-10-26 16:17:41 +02:00
parent 7407284722
commit 1358594dfa
1 changed files with 17 additions and 19 deletions

View File

@ -1,7 +1,7 @@
describe('Room Team Management - Read only', () => {
const SELECTED_CLASS_ID = 'selectedClassId';
const getOperations = ({ readOnly, classReadOnly }) => ({
const getOperations = ({readOnly, classReadOnly}) => ({
MeQuery: {
me: {
readOnly,
@ -13,25 +13,23 @@ describe('Room Team Management - Read only', () => {
},
},
RoomsQuery: {
rooms: [
{
id: '',
slug: '',
title: 'some room',
entryCount: 3,
appearance: 'red',
description: 'some description',
schoolClass: {
id: SELECTED_CLASS_ID,
name: 'bla',
},
rooms: [{
id: '',
slug: 'some-room',
title: 'some room',
entryCount: 3,
appearance: 'red',
description: 'some description',
schoolClass: {
id: SELECTED_CLASS_ID,
name: 'bla',
},
],
}],
},
});
const checkRoomsReadOnly = ({ editable, readOnly, classReadOnly = false }) => {
const operations = getOperations({ readOnly, classReadOnly });
const checkRoomsReadOnly = ({editable, readOnly, classReadOnly = false}) => {
const operations = getOperations({readOnly, classReadOnly});
cy.mockGraphqlOps({
operations,
@ -50,14 +48,14 @@ describe('Room Team Management - Read only', () => {
});
it('can edit room', () => {
checkRoomsReadOnly({ editable: true, readOnly: false });
checkRoomsReadOnly({editable: true, readOnly: false});
});
it('can not edit room', () => {
checkRoomsReadOnly({ editable: false, readOnly: true });
checkRoomsReadOnly({editable: false, readOnly: true});
});
it('can not edit room of inactive class', () => {
checkRoomsReadOnly({ editable: false, readOnly: false, classReadOnly: true });
checkRoomsReadOnly({editable: false, readOnly: false, classReadOnly: true});
});
});