76 lines
2.4 KiB
JavaScript
76 lines
2.4 KiB
JavaScript
import {getMinimalMe} from '../../../support/helpers';
|
|
import minimalModule from '../../../fixtures/module.minimal';
|
|
|
|
const {me: minimalMe} = getMinimalMe({});
|
|
|
|
describe('Instruments on Module page', () => {
|
|
beforeEach(() => {
|
|
console.log('setting up');
|
|
cy.setup();
|
|
cy.mockGraphqlOps({
|
|
operations: {
|
|
UpdateLastModule: {
|
|
updateLastModule: {
|
|
success: true,
|
|
},
|
|
},
|
|
MeQuery: {
|
|
me: minimalMe,
|
|
},
|
|
ModuleDetailsQuery: {
|
|
module: {
|
|
...minimalModule,
|
|
slug: 'module-with-instrument',
|
|
chapters: [
|
|
{
|
|
title: 'Some Chapter',
|
|
contentBlocks: [
|
|
{
|
|
'type': 'instrument',
|
|
instrumentCategory: {
|
|
id: 'category-id',
|
|
name: 'Sprache & Kommunikation'
|
|
},
|
|
'title': 'Das Interview',
|
|
'contents': [
|
|
{
|
|
'type': 'basic_knowledge',
|
|
'value': {
|
|
'description': '<p>Ein Interview dient dazu, durch Befragung Informationen zu ermitteln. Bei journalistischen Interviews werden oft Expertinnen und Experten befragt, aber auch Personen.</p>',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
{
|
|
'type': 'normal',
|
|
'title': 'Normaler Block',
|
|
instrumentCategory: null,
|
|
'contents': [
|
|
{
|
|
type: 'text_block',
|
|
value: {
|
|
text: 'Some text, not an instrument'
|
|
}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
},
|
|
});
|
|
});
|
|
it('shows the correct instrument label', () => {
|
|
cy.visit('module/module-with-instrument');
|
|
cy.getByDataCy('content-block').first().within(() => {
|
|
cy.getByDataCy('instrument-label').should('contain', 'Instrumente - Sprache & Kommunikation');
|
|
});
|
|
cy.getByDataCy('content-block').eq(1).within(() => {
|
|
cy.getByDataCy('instrument-label').should('not.exist');
|
|
});
|
|
// also check that other content blocks don't have the label
|
|
});
|
|
});
|