Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/course-outline/section-card/SectionCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const subsection = {
children: [{
id: unit.id,
}],
},
} as XBlock;
} as any, // 'as any' because we are omitting a lot of fields from 'childInfo'
} satisfies Partial<XBlock> as XBlock;

const section = {
id: '123',
Expand All @@ -63,13 +63,14 @@ const section = {
}],
},
}],
},
} as any, // 'as any' because we are omitting a lot of fields from 'childInfo'
upstreamInfo: {
readyToSync: true,
upstreamRef: 'lct:org1:lib1:section:1',
versionSynced: 1,
errorMessage: null,
},
} as XBlock;
} satisfies Partial<XBlock> as XBlock;

const onEditSectionSubmit = jest.fn();

Expand Down
9 changes: 5 additions & 4 deletions src/course-outline/subsection-card/SubsectionCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@ const subsection: XBlock = {
children: [{
id: unit.id,
}],
},
} as any, // 'as any' because we are omitting a lot of fields from 'childInfo'
upstreamInfo: {
readyToSync: true,
upstreamRef: 'lct:org1:lib1:subsection:1',
versionSynced: 1,
errorMessage: null,
},
} as XBlock;
} satisfies Partial<XBlock> as XBlock;

const section: XBlock = {
id: '123',
Expand All @@ -85,14 +86,14 @@ const section: XBlock = {
children: [{
id: subsection.id,
}],
},
} as any, // 'as any' because we are omitting a lot of fields from 'childInfo'
actions: {
draggable: true,
childAddable: true,
deletable: true,
duplicable: true,
},
} as XBlock;
} satisfies Partial<XBlock> as XBlock;

const onEditSubectionSubmit = jest.fn();

Expand Down
7 changes: 4 additions & 3 deletions src/course-outline/unit-card/UnitCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const section = {
deletable: true,
duplicable: true,
},
} as XBlock;
} satisfies Partial<XBlock> as XBlock;

const subsection = {
id: '12',
Expand All @@ -45,7 +45,7 @@ const subsection = {
deletable: true,
duplicable: true,
},
} as XBlock;
} satisfies Partial<XBlock> as XBlock;

const unit = {
id: '123',
Expand All @@ -65,8 +65,9 @@ const unit = {
readyToSync: true,
upstreamRef: 'lct:org1:lib1:unit:1',
versionSynced: 1,
errorMessage: null,
},
} as XBlock;
} satisfies Partial<XBlock> as XBlock;

const renderComponent = (props?: object) => render(
<UnitCard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ describe('<CollectionDetails />', () => {
{ blockType: 'Problem', count: 1 },
{ blockType: 'Video', count: 0 },
].forEach(({ blockType, count }) => {
const blockCount = screen.getByText(blockType).closest('div') as HTMLDivElement;
const blockCount = screen.getByText(blockType).closest('div')!;
expect(within(blockCount).getByText(count.toString())).toBeInTheDocument();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('<ComponentPreview />', () => {
it('renders a preview of the component', async () => {
initializeMocks();
render();
const iframe = (await screen.findByTitle('Preview')) as HTMLIFrameElement;
const iframe = (await screen.findByTitle<HTMLIFrameElement>('Preview'));
expect(iframe.src).toEqual(`http://localhost:18010/xblocks/v2/${usageKey}/embed/student_view/`);
});

Expand Down