From a380a465ce02059a630ef678fecd6666cbdf8f30 Mon Sep 17 00:00:00 2001
From: alex <alex@alexloehr.net>
Date: Fri, 28 Nov 2025 10:21:00 +0000
Subject: [PATCH] GS-2333

---
 test/testCourseAdmins.js |   72 ++++++++++++++++++++++++++---------
 1 files changed, 53 insertions(+), 19 deletions(-)

diff --git a/test/testCourseAdmins.js b/test/testCourseAdmins.js
index ab0b5e2..478c733 100644
--- a/test/testCourseAdmins.js
+++ b/test/testCourseAdmins.js
@@ -15,37 +15,71 @@
    afterEach(async function () {
    })
 
-   describe("the function getCourseAdmins()", function () {
-      it("should get the Admins of all courses", async function () {
-         const res = await db.getCourseAdmins()
-         console.table(res)
+
+   describe("the function getCourseAdminRoles()", function () {
+      it("should return all admin roles for all courses", async function () {
+         const res = await db.getCourseAdminRoles()
+         // console.table(res)
+         // console.log(res)
          expect(res).to.be.a("array")
          for (const item of res) {
-            expect(item).to.have.property("kurs_obj_id").and.to.be.a("number")
-            expect(item).to.have.property("kurs_ref_id").and.to.be.a("number")
-            expect(item).to.have.property("usr_id").and.to.be.a("number")
-            expect(item).to.have.property("login").and.to.be.a("string")
-            expect(item).to.have.property("firstname").and.to.be.a("string")
-            expect(item).to.have.property("lastname").and.to.be.a("string")
-            expect(item).to.have.property("title").and.to.be.a("string")
+            expect(item).to.have.property("crs_obj_id").and.to.be.a("number")
+            expect(item).to.have.property("crs_ref_id").and.to.be.a("number")
+            expect(item).to.have.property("crs_title").and.to.be.a("string")
+            expect(item).to.have.property("rol_id").and.to.be.a("number")
+            expect(item).to.have.property("role").and.to.be.a("string")
          }
       })
    })
 
-   describe("the function getCoursesWithNoAdmins()", function () {
-      it("should return all courses without a single admin member", async function () {
-         const res = await db.getCoursesWithNoAdmins()
-         console.table(res)
+   describe("the function getCoursesWithoutAdminRoles()", function () {
+      it("should return all admin roles for all courses", async function () {
+         const res = await db.getCourseWithoutAdminRoles()
+         // console.table(res)
+         console.log(res)
          expect(res).to.be.a("array")
          for (const item of res) {
-            expect(item).to.have.property("obj_id").and.to.be.a("number")
-            expect(item).to.have.property("ref_id").and.to.be.a("number")
-            expect(item).to.have.property("numTn").and.to.be.a("number")
-            expect(item).to.have.property("title").and.to.be.a("string")
+            expect(item).to.have.property("crs_obj_id").and.to.be.a("number")
+            expect(item).to.have.property("crs_ref_id").and.to.be.a("number")
+            expect(item).to.have.property("crs_title").and.to.be.a("string")
+            expect(item).to.have.property("rol_id").and.to.be.a("number")
+            expect(item).to.have.property("role").and.to.be.a("string")
          }
       })
    })
 
+   // wird nicht gebraucht - Admin Erkennung in ILIAS läuft anders ab
+   // describe("the function getCourseAdmins()", function () {
+   //    it("should get the Admins of all courses", async function () {
+   //       const res = await db.getCourseAdmins()
+   //       console.table(res)
+   //       expect(res).to.be.a("array")
+   //       for (const item of res) {
+   //          expect(item).to.have.property("kurs_obj_id").and.to.be.a("number")
+   //          expect(item).to.have.property("kurs_ref_id").and.to.be.a("number")
+   //          expect(item).to.have.property("usr_id").and.to.be.a("number")
+   //          expect(item).to.have.property("login").and.to.be.a("string")
+   //          expect(item).to.have.property("firstname").and.to.be.a("string")
+   //          expect(item).to.have.property("lastname").and.to.be.a("string")
+   //          expect(item).to.have.property("title").and.to.be.a("string")
+   //       }
+   //    })
+   // })
+   //
+   // describe("the function getCoursesWithNoAdmins()", function () {
+   //    it("should return all courses without a single admin member", async function () {
+   //       const res = await db.getCoursesWithNoAdmins()
+   //       console.table(res)
+   //       expect(res).to.be.a("array")
+   //       for (const item of res) {
+   //          expect(item).to.have.property("obj_id").and.to.be.a("number")
+   //          expect(item).to.have.property("ref_id").and.to.be.a("number")
+   //          expect(item).to.have.property("numTn").and.to.be.a("number")
+   //          expect(item).to.have.property("title").and.to.be.a("string")
+   //       }
+   //    })
+   // })
+
 })
 
 /////////////////////////////////////////////////////////////////////////

--
Gitblit v1.8.0