skillbox/client/cypress/e2e/frontend/read-only/news.spec.js

38 lines
875 B
JavaScript

import { getMinimalMe } from '../../../support/helpers';
const getOperations = ({ readOnly }) => ({
MeQuery: getMinimalMe({ readOnly }),
NewsTeasers: {
newsTeasers: [{}, {}, {}],
},
});
describe('Read Only News', () => {
beforeEach(() => {
cy.setup();
});
it('displays the news', () => {
cy.mockGraphqlOps({
operations: getOperations({ readOnly: false }),
});
cy.visit('/');
cy.getByDataCy('news-navigation-link').should('exist');
cy.getByDataCy('news-teasers').should('exist');
cy.getByDataCy('news-teaser').should('have.length', 2);
});
it('does not display the news', () => {
cy.mockGraphqlOps({
operations: getOperations({ readOnly: true }),
});
cy.visit('/');
cy.getByDataCy('news-navigation-link').should('not.exist');
cy.getByDataCy('news-teasers').should('not.exist');
});
});