chore: lint-format-docs-tests-bugfixes (#105)
* docs: add jsdoc * feat: change enums to as const objects * chore(test): add themeColors.test.ts * fix: fix tests and bugs with strings.ts util * fix: path alias imports and tsconfig file bug * fix: remove --max-warnings 0
This commit is contained in:
@@ -2,15 +2,22 @@ import getCourseTableRows from './getCourseTableRows';
|
||||
|
||||
const NEXT_PAGE_BUTTON_SELECTOR = '#next_nav_link';
|
||||
const PREV_PAGE_BUTTON_SELECTOR = '#prev_nav_link';
|
||||
|
||||
/**
|
||||
* Represents all the states that we care about when autoloading the next page of courses
|
||||
*/
|
||||
export enum AutoLoadStatus {
|
||||
LOADING = 'LOADING',
|
||||
IDLE = 'IDLE',
|
||||
ERROR = 'ERROR',
|
||||
DONE = 'DONE',
|
||||
}
|
||||
export const AutoLoadStatus = {
|
||||
LOADING: 'LOADING',
|
||||
IDLE: 'IDLE',
|
||||
ERROR: 'ERROR',
|
||||
DONE: 'DONE',
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* Represents the type of the auto load status.
|
||||
* It is a union type that includes all the values of the AutoLoadStatus object.
|
||||
*/
|
||||
export type AutoLoadStatusType = (typeof AutoLoadStatus)[keyof typeof AutoLoadStatus];
|
||||
|
||||
let isLoading = false;
|
||||
let nextPageURL = getNextButton(document)?.href;
|
||||
@@ -22,7 +29,7 @@ let nextPageURL = getNextButton(document)?.href;
|
||||
* or if there was an error loading the next page) and an array of the table rows from the next page (or an empty array
|
||||
* if we have reached the end of the course catalog
|
||||
*/
|
||||
export async function loadNextCourseCatalogPage(): Promise<[AutoLoadStatus, HTMLTableRowElement[]]> {
|
||||
export async function loadNextCourseCatalogPage(): Promise<[AutoLoadStatusType, HTMLTableRowElement[]]> {
|
||||
// if there is no more nextPageURL, then we have reached the end of the course catalog, so we can stop
|
||||
if (!nextPageURL) {
|
||||
return [AutoLoadStatus.DONE, []];
|
||||
|
||||
Reference in New Issue
Block a user