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