aboutsummaryrefslogtreecommitdiff
path: root/src/moodle-mock.ts
blob: e1554b4c09e56c55e21b3f00dcd08b88a678b801 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { getCourseId } from "./utils-ENV.js";

export class Activity {
	id: number;
	title: string;

	constructor(id: number, title: string) {
		this.id = id;
		this.title = title;
	}

	async update(_text: string) {}
}

export class Course {
	id: Number;
	title: string;

	constructor(id: number, title: string) {
		this.id = id;
		this.title = title;
	}

	async getActivity(_name: string) {
		return null;
	}
}

export async function fetchCourse(courseId?: number) {
	if (typeof courseId === "undefined") {
		courseId = Number(getCourseId());
	}

	return new Course(courseId, "Mock Course");
}

export async function fetchCourses(_pattern: string) {
	return [];
}