diff --git a/package.json b/package.json index 9cb61c894f..17d4a5c266 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "test:ci": "TZ='America/New_York' CI=true jest --ci --useStderr --coverage --coverageReporters text-summary cobertura", "test:ci:each": "lerna run test:ci", "test:dev": "TZ='America/New_York' jest --verbose --watchAll --coverage --coverageReporters lcov", + "test:view-lcov": "open ./coverage/lcov-report/index.html", "postinstall": "husky install" }, "devDependencies": { diff --git a/packages/app/obojobo-document-engine/__tests__/Viewer/components/nav.test.js b/packages/app/obojobo-document-engine/__tests__/Viewer/components/nav.test.js index f072903c55..a492627dd8 100644 --- a/packages/app/obojobo-document-engine/__tests__/Viewer/components/nav.test.js +++ b/packages/app/obojobo-document-engine/__tests__/Viewer/components/nav.test.js @@ -126,6 +126,7 @@ describe('Nav', () => { beforeEach(() => { jest.clearAllMocks() + mockDispatcherTrigger.mockReset() }) test('renders opened', () => { @@ -195,6 +196,148 @@ describe('Nav', () => { expect(tree).toMatchSnapshot() }) + test('does not try to substitute labels if no brackets are found', () => { + // this shouldn't run in this test, but if it does the label will be changed + mockDispatcherTrigger.mockImplementationOnce((trigger, event) => { + event.text = 'not-label5' + return event + }) + NavUtil.getOrderedList.mockReturnValueOnce([ + { id: 4, type: 'heading', label: 'label4' }, + { + id: 5, + type: 'link', + label: 'label5', + flags: { visited: false, complete: false, correct: false }, + // exists to be passed along to variable utilities, doesn't matter for testing + sourceModel: {} + } + ]) + const props = { + navState: { + open: false, + locked: true, + navTargetId: 56 // select this item + } + } + const component = renderer.create(