- TNL-11973: Previously Filters functionality was only working for subsections and units inside sections. Now sections are also filtered. - TNL-11974: New request, Show "no results found" if no results match the filters - TNL-11975: UI Change, Align filter menu popup to left side of filter button - TNL-11976: UI Change, Remove underline below "Course optimizer" title - TNL-11978: UI Change, Change title to "Scan my course" - TNL-11989: UI Change, Use empty space to display link, don't truncate text before the space runs out - TNL-11977: New request, Remove this stuff(scanning steps) when scan is complete, it'll disappear after 2.5 seconds - TNL-11979: UI Change, Move "This tool will scan your course..." text inside of Scan card - TNL-11980: UI Change, Move "Last scanned on..." date text below Scan button - TNL-11981: UI Change, Remove icon from "Start scanning" button - TNL-11983: UI Change, "Start scanning" button should be smaller, made it medium sized - TNL-11984: UI Change, Remove dividing line under subsection name in expanded card - TNL-11985: UI Change, Fix alignment of dividing lines, links, and icons in expanded cards to match Figma. - TNL-11986: UI Change, Match color of the broken icon with other Icons - TNL-11987: UI Change, Fix alignment of Filter chips to match Figma - Also added Beta Badge for course optimizer. - Added tests for codecov coverage
69 lines
1.6 KiB
JavaScript
69 lines
1.6 KiB
JavaScript
import { mockApiResponse } from './mocks/mockApiResponse';
|
|
import { countBrokenLinks } from './utils';
|
|
|
|
describe('countBrokenLinks', () => {
|
|
it('should return the count of broken links', () => {
|
|
const data = mockApiResponse.LinkCheckOutput;
|
|
expect(countBrokenLinks(data)).toStrictEqual(
|
|
{
|
|
brokenLinksCounts: [1, 5],
|
|
lockedLinksCounts: [1, 2],
|
|
externalForbiddenLinksCounts: [1, 3],
|
|
},
|
|
);
|
|
});
|
|
|
|
it('should return 0 if there are no broken links', () => {
|
|
const data = {
|
|
sections: [
|
|
{
|
|
subsections: [
|
|
{
|
|
units: [
|
|
{
|
|
blocks: [
|
|
{
|
|
brokenLinks: [],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
};
|
|
expect(countBrokenLinks(data)).toStrictEqual(
|
|
{
|
|
brokenLinksCounts: [0],
|
|
lockedLinksCounts: [0],
|
|
externalForbiddenLinksCounts: [0],
|
|
},
|
|
);
|
|
});
|
|
|
|
it('should return [] if there is no data', () => {
|
|
const data = {};
|
|
expect(countBrokenLinks(data)).toStrictEqual(
|
|
{
|
|
brokenLinksCounts: [],
|
|
lockedLinksCounts: [],
|
|
externalForbiddenLinksCounts: [],
|
|
},
|
|
);
|
|
});
|
|
|
|
it('should return [] if there are no sections', () => {
|
|
const data = {
|
|
sections: [],
|
|
};
|
|
expect(countBrokenLinks(data)).toStrictEqual(
|
|
{
|
|
brokenLinksCounts: [],
|
|
lockedLinksCounts: [],
|
|
externalForbiddenLinksCounts: [],
|
|
},
|
|
);
|
|
});
|
|
});
|