53 lines
1.1 KiB
JavaScript
53 lines
1.1 KiB
JavaScript
import mocks from '../../../fixtures/mocks';
|
|
import minimalModule from '../../../fixtures/module.minimal';
|
|
|
|
const getOperations = ({readOnly}) => ({
|
|
MeQuery: {
|
|
me: {
|
|
onboardingVisited: true,
|
|
readOnly,
|
|
isTeacher: true
|
|
},
|
|
},
|
|
ModuleDetailsQuery: {
|
|
module: {
|
|
...minimalModule
|
|
}
|
|
},
|
|
});
|
|
|
|
describe('Module Navigation - read only', () => {
|
|
beforeEach(() => {
|
|
cy.fakeLogin('nico.teacher', 'test');
|
|
cy.server();
|
|
cy.task('getSchema').then(schema => {
|
|
cy.mockGraphql({
|
|
schema,
|
|
mocks,
|
|
});
|
|
});
|
|
cy.viewport('macbook-15');
|
|
});
|
|
|
|
it('is not shown', () => {
|
|
cy.mockGraphqlOps({
|
|
operations: getOperations({readOnly: true}),
|
|
});
|
|
|
|
cy.visit('module/module-slug');
|
|
|
|
cy.getByDataCy('module-navigation').should('exist');
|
|
cy.getByDataCy('module-teacher-menu').should('not.exist');
|
|
});
|
|
it('is shown', () => {
|
|
cy.mockGraphqlOps({
|
|
operations: getOperations({readOnly: false}),
|
|
});
|
|
|
|
cy.visit('module/module-slug');
|
|
|
|
cy.getByDataCy('module-navigation').should('exist');
|
|
cy.getByDataCy('module-teacher-menu').should('exist');
|
|
});
|
|
});
|