Skip to content

Commit

Permalink
Added more complex timetable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chopster44 committed Mar 13, 2023
1 parent f851af5 commit 622798a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/API/edulink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class Edulink {
*/
public async getToday(): Promise<Day> {
//@ts-ignore
let rawWeek: Week = this.getThisWeek();
let rawWeek: Week = await this.getThisWeek();
for (let i = 0; i < rawWeek.days.length; i++) {
if (rawWeek.days[i].is_current === true) {
return rawWeek.days[i]
Expand Down
6 changes: 6 additions & 0 deletions src/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ async function main () {
if (thisWeek == undefined) {
throw new Error("Timetable Error: out from getThisWeek() is undefined");
}
if (!thisWeek.is_current) {
throw new Error("Timetable Error: this week is not this week");
}

let today = await edulinkTest.getToday();
if (today == undefined) {
throw new Error("Timetable Error: out from getToday() is undefined");
}
if (!today.is_current) {
throw new Error("Timetable Error: today is not today");
}
}

try {
Expand Down

0 comments on commit 622798a

Please sign in to comment.