diff --git a/Makefile b/Makefile index 3de19f2..57922cb 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: lint test +.PHONY: lint #test .DEFAULT_GOAL=dist PACKAGE_MANAGER=yarn @@ -8,8 +8,8 @@ node_modules: package.json yarn.lock ## Installer les dépendances dist: node_modules src tsconfig.json ## Construire les fichiers de distribution npx tsc -p tsconfig.json -test: node_modules tests ## Tests unitaires - npx jest +#test: node_modules tests ## Tests unitaires +# npx jest lint: node_modules .eslintrc .eslintignore ## Analyse statique du code npx eslint src/ tests/ --ext .ts diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index 48f3ea3..0000000 --- a/jest.config.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - moduleFileExtensions: [ - 'js', - 'ts', - ], - testMatch: [ - '**/tests/**/*.test.ts', - ], - moduleNameMapper: { - '^axios$': require.resolve('axios'), - }, - testEnvironment: 'node', - preset: 'ts-jest', -} diff --git a/tests/Calendar/Agenda.test.ts b/tests/Calendar/Agenda.test.ts deleted file mode 100644 index 61902f2..0000000 --- a/tests/Calendar/Agenda.test.ts +++ /dev/null @@ -1,1379 +0,0 @@ -import { describe } from 'node:test' -import { Agenda } from '../../src/models/Calendar/Agenda' - -type ExpectedType = Agenda[] - -describe('Test Agenda', () => { - it('should be correct type', () => { - const data: ExpectedType = [ - { - 'id': 'ESKO-P-X', - 'date': '2023-05-01', - 'lessons': [], - 'homeworkAssignments': [] - }, - { - 'id': 'ESKO-P-X', - 'date': '2023-05-02', - 'lessons': [ - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - } - ], - 'homeworkAssignments': [ - { - 'id': '00000', - 'title': 'Chapitre 8 (8.0 8.1 8.2) Electricité', - 'html': '', - 'dueDateTime': '2023-05-03T06:00:00Z', - 'dueDate': null, - 'done': false, - 'deliverWorkOnline': false, - 'onlineDeliveryUrl': null, - 'subject': { - 'id': '3ce9205e72b448aaa4bfe1cc51e73593', - 'label': 'PHYSIQUE-CHIMIE', - 'color': '#008000' - } - }, - { - 'id': '00000', - 'title': 'Chapitre 8 (8.0 8.1 8.2) Electricité', - 'html': '', - 'dueDateTime': '2023-05-03T06:00:00Z', - 'dueDate': null, - 'done': false, - 'deliverWorkOnline': false, - 'onlineDeliveryUrl': null, - 'subject': { - 'id': '3ce9205e72b448aaa4bfe1cc51e73593', - 'label': 'PHYSIQUE-CHIMIE', - 'color': '#008000' - } - } - ] - }, - { - 'id': 'ESKO-P-X', - 'date': '2023-05-03', - 'lessons': [ - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - } - ], - 'homeworkAssignments': [ - { - 'id': '00000', - 'title': 'Chapitre 8 (8.0 8.1 8.2) Electricité', - 'html': '', - 'dueDateTime': '2023-05-03T06:00:00Z', - 'dueDate': null, - 'done': false, - 'deliverWorkOnline': false, - 'onlineDeliveryUrl': null, - 'subject': { - 'id': '3ce9205e72b448aaa4bfe1cc51e73593', - 'label': 'PHYSIQUE-CHIMIE', - 'color': '#008000' - } - }, - { - 'id': '00000', - 'title': 'Chapitre 8 (8.0 8.1 8.2) Electricité', - 'html': '', - 'dueDateTime': '2023-05-03T06:00:00Z', - 'dueDate': null, - 'done': false, - 'deliverWorkOnline': false, - 'onlineDeliveryUrl': null, - 'subject': { - 'id': '3ce9205e72b448aaa4bfe1cc51e73593', - 'label': 'PHYSIQUE-CHIMIE', - 'color': '#008000' - } - }, - { - 'id': '00000', - 'title': 'Chapitre 8 (8.0 8.1 8.2) Electricité', - 'html': '', - 'dueDateTime': '2023-05-03T06:00:00Z', - 'dueDate': null, - 'done': false, - 'deliverWorkOnline': false, - 'onlineDeliveryUrl': null, - 'subject': { - 'id': '3ce9205e72b448aaa4bfe1cc51e73593', - 'label': 'PHYSIQUE-CHIMIE', - 'color': '#008000' - } - }, - { - 'id': '00000', - 'title': 'Chapitre 8 (8.0 8.1 8.2) Electricité', - 'html': '', - 'dueDateTime': '2023-05-03T06:00:00Z', - 'dueDate': null, - 'done': false, - 'deliverWorkOnline': false, - 'onlineDeliveryUrl': null, - 'subject': { - 'id': '3ce9205e72b448aaa4bfe1cc51e73593', - 'label': 'PHYSIQUE-CHIMIE', - 'color': '#008000' - } - } - ] - }, - { - 'id': 'ESKO-P-X', - 'date': '2023-05-04', - 'lessons': [ - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - } - ], - 'homeworkAssignments': [] - }, - { - 'id': 'ESKO-P-X', - 'date': '2023-05-05', - 'lessons': [ - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - } - ], - 'homeworkAssignments': [] - }, - { - 'id': 'ESKO-P-X', - 'date': '2023-05-06', - 'lessons': [], - 'homeworkAssignments': [] - }, - { - 'id': 'ESKO-P-X', - 'date': '2023-05-07', - 'lessons': [], - 'homeworkAssignments': [] - }, - { - 'id': 'ESKO-P-X', - 'date': '2023-05-08', - 'lessons': [], - 'homeworkAssignments': [] - }, - { - 'id': 'ESKO-P-X', - 'date': '2023-05-09', - 'lessons': [ - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - } - ], - 'homeworkAssignments': [ - { - 'id': '00000', - 'title': 'Chapitre 8 (8.0 8.1 8.2) Electricité', - 'html': '', - 'dueDateTime': '2023-05-03T06:00:00Z', - 'dueDate': null, - 'done': false, - 'deliverWorkOnline': false, - 'onlineDeliveryUrl': null, - 'subject': { - 'id': '3ce9205e72b448aaa4bfe1cc51e73593', - 'label': 'PHYSIQUE-CHIMIE', - 'color': '#008000' - } - } - ] - }, - { - 'id': 'ESKO-P-X', - 'date': '2023-05-10', - 'lessons': [ - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - } - ], - 'homeworkAssignments': [ - { - 'id': '00000', - 'title': 'Chapitre 8 (8.0 8.1 8.2) Electricité', - 'html': '', - 'dueDateTime': '2023-05-03T06:00:00Z', - 'dueDate': null, - 'done': false, - 'deliverWorkOnline': false, - 'onlineDeliveryUrl': null, - 'subject': { - 'id': '3ce9205e72b448aaa4bfe1cc51e73593', - 'label': 'PHYSIQUE-CHIMIE', - 'color': '#008000' - } - } - ] - }, - { - 'id': 'ESKO-P-X', - 'date': '2023-05-11', - 'lessons': [ - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - } - ], - 'homeworkAssignments': [] - }, - { - 'id': 'ESKO-P-X', - 'date': '2023-05-12', - 'lessons': [ - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - } - ], - 'homeworkAssignments': [] - }, - { - 'id': 'ESKO-P-X', - 'date': '2023-05-13', - 'lessons': [], - 'homeworkAssignments': [] - }, - { - 'id': 'ESKO-P-X', - 'date': '2023-05-14', - 'lessons': [], - 'homeworkAssignments': [] - }, - { - 'id': 'ESKO-P-X', - 'date': '2023-05-15', - 'lessons': [ - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - }, - { - 'id': '00000', - 'startDateTime': '2023-05-04T06:00:00Z', - 'endDateTime': '2023-05-04T06:55:00Z', - 'title': 'LATIN', - 'location': '00000', - 'locationComplement': null, - 'canceled': true, - 'teachers': [ - { - 'id': 'PSKO-P-X', - 'title': 'M.', - 'firstName': 'X', - 'lastName': 'X', - 'photoUrl': null - } - ], - 'subject': { - 'id': 'fcd026e0b2f74ac49781cbdae56dcc33', - 'label': 'LATIN', - 'color': '#d7ffff' - } - } - ], - 'homeworkAssignments': [ - { - 'id': '00000', - 'title': 'Chapitre 8 (8.0 8.1 8.2) Electricité', - 'html': '', - 'dueDateTime': '2023-05-03T06:00:00Z', - 'dueDate': null, - 'done': false, - 'deliverWorkOnline': false, - 'onlineDeliveryUrl': null, - 'subject': { - 'id': '3ce9205e72b448aaa4bfe1cc51e73593', - 'label': 'PHYSIQUE-CHIMIE', - 'color': '#008000' - } - } - ] - } - ] - expect(data).toBeDefined() - }) -}) - diff --git a/tests/Common/User.test.ts b/tests/Common/User.test.ts deleted file mode 100644 index 1565cf4..0000000 --- a/tests/Common/User.test.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { describe } from 'node:test' -import { User } from '../../src/models/Common/User' - -type ExpectedType = User - -describe('Test User', () => { - it('should be correct type', () => { - const data: ExpectedType = { - 'id': 'RSKO-P-X', - 'addressLines': [ - '1 RUE DU TEST UNITAIRE' - ], - 'postalCode': '68160', - 'city': 'STE MARIE AUX MINES', - 'country': 'FRANCE', - 'lastName': 'DOE', - 'firstName': 'John', - 'photoUrl': null, - 'externalMail': 'johnn.doe@example.com', - 'mobilePhone': '+33 6 00 00 00 00', - 'permissions': [ - { - 'schoolId': 'SKO-E-X', - 'service': 'EVAL', - 'permittedOperations': [ - 'READ_EVALUATIONS' - ] - }, - { - 'schoolId': 'SKO-E-X', - 'service': 'CDT', - 'permittedOperations': [ - 'READ_LESSONS' - ] - }, - { - 'schoolId': 'SKO-E-X', - 'service': 'TAF', - 'permittedOperations': [ - 'READ_HOMEWORK_ASSIGNMENTS' - ] - }, - { - 'schoolId': 'SKO-E-X', - 'service': 'ABS', - 'permittedOperations': [ - 'READ_ABSENCE_FILES', - 'READ_ABSENCE_FILES_DETAILS', - 'COMPLETE_ABSENCE_FILES' - ] - }, - { - 'schoolId': 'SKO-E-X', - 'service': 'MSG', - 'permittedOperations': [ - 'READ_MESSAGES', - 'WRITE_MESSAGES' - ] - } - ], - 'students': [ - { - 'id': 'ESKO-P-X', - 'lastName': 'DOE', - 'firstName': 'John Junior', - 'photoUrl': null, - 'className': '3EME0', - 'dateOfBirth': '2000-01-01', - 'regime': 'EXTERNE LIBRE' - } - ] - } - expect(data).toBeDefined() - }) -}) - diff --git a/tests/School/Schools.test.ts b/tests/School/Schools.test.ts deleted file mode 100644 index 3793c40..0000000 --- a/tests/School/Schools.test.ts +++ /dev/null @@ -1,195 +0,0 @@ -import { describe } from 'node:test' -import { School } from '../../src/models/School/School' -import { Skolengo } from '../../src' -import axios from 'axios' - -type ExpectedType = School[] - -jest.mock('axios') - -const mockedAxios = axios as jest.Mocked & jest.Mock -mockedAxios.request.mockResolvedValue({ - data: {} -}) - -describe('Test Schools', () => { - it('should be correct type', () => { - const data: ExpectedType = [ - { - 'id': 'SKO-E-c8820154-e9a6-4de6-95c1-23e9e0178ad9', - 'name': 'Collège', - 'addressLine1': '5 rue du Lycée', - 'addressLine2': null, - 'addressLine3': null, - 'zipCode': '67142', - 'city': 'BARR CEDEX', - 'country': 'France', - 'homePageUrl': 'https://cas.monbureaunumerique.fr/login?service=https%3A%2F%2Fclg-barr.monbureaunumerique.fr%2Fsg.do%3FPROC%3DPAGE_ACCUEIL', - 'emsCode': 'gdest', - 'emsOIDCWellKnownUrl': 'https://sso.monbureaunumerique.fr/oidc/.well-known' - }, - { - 'id': 'SKO-E-c4b08331-c9b9-4958-885c-8dca52f4b9f6', - 'name': 'Collège André Maurois', - 'addressLine1': '1 rue du Lycée', - 'addressLine2': null, - 'addressLine3': null, - 'zipCode': '67242', - 'city': 'BISCHWILLER CEDEX', - 'country': 'France', - 'homePageUrl': 'https://cas.monbureaunumerique.fr/login?service=https%3A%2F%2Fcite-maurois.monbureaunumerique.fr%2Fsg.do%3FPROC%3DPAGE_ACCUEIL', - 'emsCode': 'gdest', - 'emsOIDCWellKnownUrl': 'https://sso.monbureaunumerique.fr/oidc/.well-known' - }, - { - 'id': 'SKO-E-a1b245ba-2109-4d29-975c-7861e6316d7e', - 'name': 'Collège Christiane Perceret', - 'addressLine1': '8 rue du Lycée', - 'addressLine2': null, - 'addressLine3': null, - 'zipCode': '21140', - 'city': 'SEMUR EN AUXOIS', - 'country': 'France', - 'homePageUrl': 'https://cas.eclat-bfc.fr/login?service=https%3A%2F%2Fclg-cperceret-semur-en-auxois.eclat-bfc.fr%2Fsg.do%3FPROC%3DPAGE_ACCUEIL', - 'emsCode': 'bfc', - 'emsOIDCWellKnownUrl': 'https://sso.eclat-bfc.fr/oidc/.well-known' - }, - { - 'id': 'SKO-E-0e087c33-a55c-4fba-873c-5773ef439f3c', - 'name': 'Etablissement régional d\'enseignement adapté Cité Scolaire René Pellet - Lycée des métiers du tertiaire et de l\'artisanat d\'art', - 'addressLine1': '32 rue DE FRANCE', - 'addressLine2': null, - 'addressLine3': null, - 'zipCode': '69602', - 'city': 'VILLEURBANNE CEDEX', - 'country': 'France', - 'homePageUrl': 'https://cas.ent.auvergnerhonealpes.fr/login?service=https%3A%2F%2Ferea-pellet.ent.auvergnerhonealpes.fr%2Fsg.do%3FPROC%3DPAGE_ACCUEIL', - 'emsCode': 'rra', - 'emsOIDCWellKnownUrl': 'https://sso.ent.auvergnerhonealpes.fr/oidc/.well-known' - }, - { - 'id': 'SKO-E-843f920a-c50b-4196-8ea4-be268ca530e9', - 'name': 'LPO Louis Aragon - Lycée des métiers de l\'énergie et du développement durable', - 'addressLine1': 'Rue Pierre Mendès France', - 'addressLine2': null, - 'addressLine3': null, - 'zipCode': '70400', - 'city': 'HERICOURT', - 'country': 'France', - 'homePageUrl': 'https://cas.eclat-bfc.fr/login?service=https%3A%2F%2Flyc-laragon-hericourt.eclat-bfc.fr%2Fsg.do%3FPROC%3DPAGE_ACCUEIL', - 'emsCode': 'bfc', - 'emsOIDCWellKnownUrl': 'https://sso.eclat-bfc.fr/oidc/.well-known' - }, - { - 'id': 'SKO-E-494401bd-d47f-47d1-9cf5-ab330c420934', - 'name': 'LPO Victor Bérard - Lycée des métiers de l\'optique et des microtechniques', - 'addressLine1': '35 quai Aimé Lamy', - 'addressLine2': null, - 'addressLine3': null, - 'zipCode': '39403', - 'city': 'MOREZ CEDEX', - 'country': 'France', - 'homePageUrl': 'https://cas.eclat-bfc.fr/login?service=https%3A%2F%2Flyc-vberard-morez.eclat-bfc.fr%2Fsg.do%3FPROC%3DPAGE_ACCUEIL', - 'emsCode': 'bfc', - 'emsOIDCWellKnownUrl': 'https://sso.eclat-bfc.fr/oidc/.well-known' - }, - { - 'id': 'SKO-E-9e62345b-5625-4a25-8941-0ca97351c604', - 'name': 'Lycée professionnel Gustave Eiffel - Lycées des métiers du bâtiment et des travaux publics', - 'addressLine1': 'Rue Gustave Eiffel', - 'addressLine2': null, - 'addressLine3': null, - 'zipCode': '68701', - 'city': 'CERNAY CEDEX', - 'country': 'France', - 'homePageUrl': 'https://cas.monbureaunumerique.fr/login?service=https%3A%2F%2Flyc-eiffel-cernay.monbureaunumerique.fr%2Fsg.do%3FPROC%3DPAGE_ACCUEIL', - 'emsCode': 'gdest', - 'emsOIDCWellKnownUrl': 'https://sso.monbureaunumerique.fr/oidc/.well-known' - }, - { - 'id': 'SKO-E-1a08c3d4-b75f-4ea7-bf9a-fb5c25d554cd', - 'name': 'Lycée André Citroen - Lycée des métiers de l\'automobile', - 'addressLine1': '5 RUE DU 11EME REGIMENT D\'AVIATION', - 'addressLine2': null, - 'addressLine3': null, - 'zipCode': '57155', - 'city': 'MARLY', - 'country': 'France', - 'homePageUrl': 'https://cas.monbureaunumerique.fr/login?service=https%3A%2F%2Flyc-citroen.monbureaunumerique.fr%2Fsg.do%3FPROC%3DPAGE_ACCUEIL', - 'emsCode': 'gdest', - 'emsOIDCWellKnownUrl': 'https://sso.monbureaunumerique.fr/oidc/.well-known' - }, - { - 'id': 'SKO-E-c83e275b-d61d-46d8-99bd-852c9d189cdb', - 'name': 'Lycée André Malraux - Lycée des métiers filière bois', - 'addressLine1': '13 rue DE L\'EPINETTE', - 'addressLine2': null, - 'addressLine3': null, - 'zipCode': '88204', - 'city': 'REMIREMONT CEDEX', - 'country': 'France', - 'homePageUrl': 'https://cas.monbureaunumerique.fr/login?service=https%3A%2F%2Flyc-malraux.monbureaunumerique.fr%2Fsg.do%3FPROC%3DPAGE_ACCUEIL', - 'emsCode': 'gdest', - 'emsOIDCWellKnownUrl': 'https://sso.monbureaunumerique.fr/oidc/.well-known' - }, - { - 'id': 'SKO-E-72952dd9-fbff-4909-ae12-ea4b73c67467', - 'name': 'Lycée Atlas', - 'addressLine1': '8 rue Kervégan', - 'addressLine2': '', - 'addressLine3': '', - 'zipCode': '44240', - 'city': 'Nantes', - 'country': 'France', - 'homePageUrl': 'https://cas1.kosmoseducation.com/login?service=https%3A%2F%2Fatlas.kosmoseducation.com%2Fsg.do%3FPROC%3DPAGE_ACCUEIL', - 'emsCode': 'metab', - 'emsOIDCWellKnownUrl': 'https://sso1.skolengo.com/oidc/.well-known' - } - ] - - expect(data).toBeDefined() - }) - - it('should searchSchool make the right request', async () => { - await Skolengo.searchSchool({ text: 'Lycée Louise Weiss' }, 10, 0) - expect(mockedAxios.request).toBeCalledWith({ - baseURL: 'https://api.skolengo.com/api/v1/bff-sko-app', - url: '/schools', - method: 'get', - params: { - filter: { - text: 'Lycée Louise Weiss', - }, - page: { - limit: 10, - offset: 0 - } - }, - responseType: 'json' - }) - }) - - it('should searchSchool make the right request with GPS', async () => { - await Skolengo.searchSchool({ - lat: 48.0, - lon: 7.0 - }, 10, 0) - expect(mockedAxios.request).toBeCalledWith({ - baseURL: 'https://api.skolengo.com/api/v1/bff-sko-app', - url: '/schools', - method: 'get', - params: { - filter: { - lat: 48.0, - lon: 7.0 - }, - page: { - limit: 10, - offset: 0 - } - }, - responseType: 'json' - }) - }) -}) -