AA-197: Handle non-cert learners that can upgrade (#263)

Tell them about verified certificates and link to ecommerce.

Also fixes AA-376 by handling the no-verified-mode-to-upgrade-to
case.
This commit is contained in:
Michael Terry
2020-10-27 11:28:52 -04:00
committed by GitHub
parent 4eb52a592d
commit 6f415544be
9 changed files with 209 additions and 21 deletions

View File

@@ -98,11 +98,17 @@ describe('Sequence Navigation', () => {
expect(screen.getByRole('button', { name: /next/i })).toBeEnabled();
});
it('has the "Next" button disabled for the last unit of the sequence', () => {
render(<SequenceNavigation
{...mockData}
unitId={unitBlocks[unitBlocks.length - 1].id}
/>);
it('has the "Next" button disabled for the last unit of the sequence if there is no Exit page', async () => {
const testMetadata = { ...courseMetadata, certificate_data: { cert_status: 'bogus_status' }, user_has_passing_grade: true };
const testStore = await initializeTestStore({ courseMetadata: testMetadata, unitBlocks }, false);
// Have to refetch the sequenceId since the new store generates new sequences
const { courseware } = testStore.getState();
const testData = { ...mockData, sequenceId: courseware.sequenceId };
render(
<SequenceNavigation {...testData} unitId={unitBlocks[unitBlocks.length - 1].id} />,
{ store: testStore },
);
expect(screen.getByRole('button', { name: /previous/i })).toBeEnabled();
expect(screen.getByRole('button', { name: /next/i })).toBeDisabled();

View File

@@ -73,8 +73,17 @@ describe('Unit Navigation', () => {
expect(screen.getByRole('button', { name: /next/i })).toBeEnabled();
});
it('has the "Next" button disabled for the last unit in the sequence if there is no Exit Page', () => {
render(<UnitNavigation {...mockData} unitId={unitBlocks[unitBlocks.length - 1].id} />);
it('has the "Next" button disabled for the last unit in the sequence if there is no Exit Page', async () => {
const testCourseMetadata = { ...courseMetadata, certificate_data: { cert_status: 'bogus_status' }, user_has_passing_grade: true };
const testStore = await initializeTestStore({ courseMetadata: testCourseMetadata, unitBlocks }, false);
// Have to refetch the sequenceId since the new store generates new sequences
const { courseware } = testStore.getState();
const testData = { ...mockData, sequenceId: courseware.sequenceId };
render(
<UnitNavigation {...testData} unitId={unitBlocks[unitBlocks.length - 1].id} />,
{ store: testStore },
);
expect(screen.getByRole('button', { name: /previous/i })).toBeEnabled();
expect(screen.getByRole('button', { name: /next/i })).toBeDisabled();