Skip to content

Commit

Permalink
Merge branch 'main' into BC-8480
Browse files Browse the repository at this point in the history
  • Loading branch information
bischofmax committed Jan 15, 2025
2 parents cc89a33 + ace7342 commit 267083e
Show file tree
Hide file tree
Showing 670 changed files with 2,026 additions and 1,715 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { axiosErrorFactory } from '@shared/testing/factory';
import { axiosErrorFactory } from '@testing/factory/axios-error.factory';
import { AxiosError } from 'axios';
import { AxiosErrorLoggable } from './axios-error.loggable';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { EntityManager } from '@mikro-orm/mongodb';
import { ServerTestModule } from '@modules/server';
import { Controller, Get, INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { TestApiClient, UserAndAccountTestFactory } from '@shared/testing';
import { UserAndAccountTestFactory } from '@testing/factory/user-and-account.test.factory';
import { TestApiClient } from '@testing/test-api-client';
import { ICurrentUser } from '../interface';
import { CurrentUser, JWT, JwtAuthentication } from './jwt-auth.decorator';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setupEntities } from '@shared/testing';
import { setupEntities } from '@testing/setup-entities';
import { ObjectId } from 'bson';
import { ICurrentUser } from '../interface';
import { CurrentUserBuilder } from './current-user.factory';
Expand Down
3 changes: 2 additions & 1 deletion apps/server/src/infra/auth-guard/mapper/jwt.factory.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { currentUserFactory, setupEntities } from '@shared/testing';
import { currentUserFactory } from '@testing/factory/currentuser.factory';
import { setupEntities } from '@testing/setup-entities';
import { ObjectId } from 'bson';
import { CreateJwtPayload } from '../interface';
import { JwtPayloadFactory } from './jwt.factory';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { UnauthorizedException } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { jwtPayloadFactory } from '@shared/testing';
import { jwtPayloadFactory } from '@testing/factory/jwtpayload.factory';
import { JwtValidationAdapter } from '../adapter/jwt-validation.adapter';
import { JwtStrategy } from './jwt.strategy';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { ConfigService } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { WsException } from '@nestjs/websockets';
import { jwtPayloadFactory } from '@shared/testing';
import { jwtPayloadFactory } from '@testing/factory/jwtpayload.factory';
import { JwtValidationAdapter } from '../adapter';
import { WsJwtStrategy } from './ws-jwt.strategy';

Expand Down
18 changes: 9 additions & 9 deletions apps/server/src/infra/calendar/service/calendar.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { Configuration } from '@hpi-schul-cloud/commons/lib';
import { CalendarEventDto, CalendarService } from '@infra/calendar';
import { HttpService } from '@nestjs/axios';
import { HttpStatus, InternalServerErrorException } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { axiosResponseFactory } from '@shared/testing';
import { AxiosResponse } from 'axios';
import { of, throwError } from 'rxjs';
import { Logger } from '@src/core/logger';
import { EntityId } from '@shared/domain/types';
import {
DomainDeletionReportBuilder,
DomainName,
DomainOperationReportBuilder,
OperationType,
} from '@modules/deletion';
import { HttpService } from '@nestjs/axios';
import { HttpStatus, InternalServerErrorException } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { EntityId } from '@shared/domain/types';
import { Logger } from '@src/core/logger';
import { axiosResponseFactory } from '@testing/factory/axios-response.factory';
import { AxiosResponse } from 'axios';
import { of, throwError } from 'rxjs';
import { CalendarEventId } from '../interface/calendar-event-id.interface';
import { CalendarEvent } from '../interface/calendar-event.interface';
import { CalendarMapper } from '../mapper/calendar.mapper';
import { CalendarEventId } from '../interface/calendar-event-id.interface';

describe('CalendarServiceSpec', () => {
let module: TestingModule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { ObjectId } from '@mikro-orm/mongodb';
import { HttpService } from '@nestjs/axios';
import { NotFoundException, NotImplementedException, UnprocessableEntityException } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { axiosResponseFactory } from '@shared/testing';
import { LegacyLogger } from '@src/core/logger';
import { axiosResponseFactory } from '@testing/factory/axios-response.factory';
import { AxiosResponse } from 'axios';
import { Observable, of } from 'rxjs';
import { NextcloudClient } from './nextcloud.client';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ import { LtiToolDO } from '@shared/domain/domainobject/ltitool.do';
import { LtiPrivacyPermission, LtiRoleType, User } from '@shared/domain/entity';
import { RoleName } from '@shared/domain/interface';
import { LtiToolRepo } from '@shared/repo';
import { ltiToolDOFactory, pseudonymFactory, setupEntities, userDoFactory, userFactory } from '@shared/testing';
import { LegacyLogger } from '@src/core/logger';
import { ltiToolDOFactory, pseudonymFactory } from '@testing/factory/domainobject';
import { userDoFactory } from '@testing/factory/user.do.factory';
import { userFactory } from '@testing/factory/user.factory';
import { setupEntities } from '@testing/setup-entities';
import { TeamRolePermissionsDto } from '../../dto/team-role-permissions.dto';
import { NextcloudClient } from './nextcloud.client';
import { NextcloudStrategy } from './nextcloud.strategy';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { MongoMemoryDatabaseModule } from '@infra/database';
import { MikroORM } from '@mikro-orm/core';
import { EntityManager, ObjectId } from '@mikro-orm/mongodb';
import { Test, TestingModule } from '@nestjs/testing';
import { createCollections } from '@shared/testing';
import { createCollections } from '@testing/create-collections';
import { DatabaseManagementService } from './database-management.service';

const randomChars = () => new ObjectId().toHexString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import AuthenticationFlowRepresentation from '@keycloak/keycloak-admin-client/li
import { EntityManager } from '@mikro-orm/mongodb';
import { ConfigModule } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { systemEntityFactory } from '@shared/testing/factory';
import { LoggerModule } from '@src/core/logger';
import { systemEntityFactory } from '@testing/factory/systemEntityFactory';
import { v1 } from 'uuid';
import { KeycloakAdministrationService } from '../../keycloak-administration/service/keycloak-administration.service';
import { KeycloakConfigurationModule } from '../keycloak-configuration.module';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import KeycloakAdminClient from '@keycloak/keycloak-admin-client';
import { EntityManager } from '@mikro-orm/mongodb';
import { ConfigModule } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { cleanupCollections } from '@shared/testing';
import { LoggerModule } from '@src/core/logger';
import { AccountEntity } from '@src/modules/account/domain/entity/account.entity';
import { accountFactory } from '@src/modules/account/testing';
import { cleanupCollections } from '@testing/cleanup-collections';
import { v1 } from 'uuid';
import { KeycloakAdministrationService } from '../../keycloak-administration/service/keycloak-administration.service';
import { KeycloakConfigurationModule } from '../keycloak-configuration.module';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { InternalServerErrorException } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { setupEntities } from '@shared/testing';
import { Logger } from '@src/core/logger';
import { setupEntities } from '@testing/setup-entities';
import { ErrorMapper, FilesPreviewEvents, FilesPreviewExchange } from '../rabbitmq';
import { PreviewFileOptions } from './interface';
import { PreviewProducer } from './preview.producer';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { OauthAdapterService, OAuthTokenDto } from '@modules/oauth';
import { HttpService } from '@nestjs/axios';
import { axiosResponseFactory } from '@shared/testing';
import { Logger } from '@src/core/logger';
import { axiosResponseFactory } from '@testing/factory/axios-response.factory';
import { of } from 'rxjs';
import { SchulconnexConfigurationMissingLoggable } from './loggable';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import { MediaSourceBasicAuthConfigNotFoundLoggableException } from '@modules/me
import { mediaSourceFactory } from '@modules/media-source/testing';
import { ConfigService } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { axiosErrorFactory, axiosResponseFactory } from '@shared/testing';
import { AxiosErrorLoggable } from '@src/core/error/loggable';
import { axiosErrorFactory } from '@testing/factory/axios-error.factory';
import { axiosResponseFactory } from '@testing/factory/axios-response.factory';
import { AxiosResponse, RawAxiosRequestConfig } from 'axios';
import { vidisPageOfferFactory } from '../testing';
import { VidisFetchService } from './vidis-fetch.service';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { MongoMemoryDatabaseModule } from '@infra/database';
import { EntityManager } from '@mikro-orm/mongodb';
import { Test, TestingModule } from '@nestjs/testing';
import { SchoolEntity } from '@shared/domain/entity';
import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy';
import { SchoolFeature } from '@shared/domain/types';
import { cleanupCollections, schoolEntityFactory, systemEntityFactory } from '@shared/testing';
import { Logger } from '@src/core/logger';
import { MongoMemoryDatabaseModule } from '@src/infra/database';
import { SystemType } from '@src/modules/system';
import { cleanupCollections } from '@testing/cleanup-collections';
import { schoolEntityFactory } from '@testing/factory/school-entity.factory';
import { systemEntityFactory } from '@testing/factory/systemEntityFactory';
import { TspLegacyMigrationSystemMissingLoggable } from './loggable/tsp-legacy-migration-system-missing.loggable';
import { TspLegacyMigrationService } from './tsp-legacy-migration.service';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { UserService } from '@modules/user';
import { ConfigService } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { UserSourceOptions } from '@shared/domain/domainobject/user-source-options.do';
import { userDoFactory } from '@shared/testing';
import { Logger } from '@src/core/logger';
import { accountDoFactory } from '@src/modules/account/testing';
import { userDoFactory } from '@testing/factory/user.do.factory';
import { TspSyncMigrationService } from './tsp-sync-migration.service';
import { TspSyncConfig } from './tsp-sync.config';

Expand Down
3 changes: 2 additions & 1 deletion apps/server/src/infra/sync/tsp/tsp-sync.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import { School, SchoolService } from '@modules/school';
import { SystemService, SystemType } from '@modules/system';
import { Test, TestingModule } from '@nestjs/testing';
import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy';
import { federalStateFactory, schoolYearFactory } from '@shared/testing';
import { FederalStateService, SchoolYearService } from '@src/modules/legacy-school';
import { FileStorageType, SchoolProps } from '@src/modules/school/domain';
import { FederalStateEntityMapper, SchoolYearEntityMapper } from '@src/modules/school/repo/mikro-orm/mapper';
import { schoolFactory } from '@src/modules/school/testing';
import { systemFactory } from '@src/modules/system/testing';
import { federalStateFactory } from '@testing/factory/federal-state.factory';
import { schoolYearFactory } from '@testing/factory/schoolyear.factory';
import { TspSyncService } from './tsp-sync.service';

describe(TspSyncService.name, () => {
Expand Down
5 changes: 4 additions & 1 deletion apps/server/src/modules/account/api/account.uc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import { UnauthorizedException } from '@nestjs/common/exceptions/unauthorized.ex
import { Role, User } from '@shared/domain/entity';
import { Permission, RoleName } from '@shared/domain/interface';
import { EntityId } from '@shared/domain/types';
import { currentUserFactory, schoolEntityFactory, setupEntities, userFactory } from '@shared/testing';
import { currentUserFactory } from '@testing/factory/currentuser.factory';
import { schoolEntityFactory } from '@testing/factory/school-entity.factory';
import { userFactory } from '@testing/factory/user.factory';
import { setupEntities } from '@testing/setup-entities';
import { Account, AccountSave } from '../domain';
import { AccountEntity } from '../domain/entity/account.entity';
import { AccountService } from '../domain/services';
Expand Down
6 changes: 5 additions & 1 deletion apps/server/src/modules/account/api/test/account.api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { User } from '@shared/domain/entity';
import { Permission, RoleName } from '@shared/domain/interface';
import { TestApiClient, cleanupCollections, roleFactory, schoolEntityFactory, userFactory } from '@shared/testing';
import { cleanupCollections } from '@testing/cleanup-collections';
import { roleFactory } from '@testing/factory/role.factory';
import { schoolEntityFactory } from '@testing/factory/school-entity.factory';
import { userFactory } from '@testing/factory/user.factory';
import { TestApiClient } from '@testing/test-api-client';
import { AccountEntity } from '../../domain/entity/account.entity';
import { accountFactory } from '../../testing';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import { Test, TestingModule } from '@nestjs/testing';
import { EntityNotFoundError } from '@shared/common';
import { IdmAccount } from '@shared/domain/interface';
import { EntityId } from '@shared/domain/types';
import { setupEntities, userFactory } from '@shared/testing';
import { Logger } from '@src/core/logger';
import { userFactory } from '@testing/factory/user.factory';
import { setupEntities } from '@testing/setup-entities';
import bcrypt from 'bcryptjs';
import { v1 } from 'uuid';
import { AccountConfig } from '../../account-config';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import { createMock } from '@golevelup/ts-jest';
import { MongoMemoryDatabaseModule } from '@infra/database';
import { IdentityManagementModule, IdentityManagementService } from '@infra/identity-management';
import { KeycloakAdministrationService } from '@infra/identity-management/keycloak-administration/service/keycloak-administration.service';
import { KeycloakIdentityManagementService } from '@infra/identity-management/keycloak/service/keycloak-identity-management.service';
import KeycloakAdminClient from '@keycloak/keycloak-admin-client-cjs/keycloak-admin-client-cjs-index';
import { EntityManager, ObjectId } from '@mikro-orm/mongodb';
import { ConfigModule } from '@nestjs/config';
import { EventBus } from '@nestjs/cqrs';
import { Test, TestingModule } from '@nestjs/testing';
import { IdmAccount } from '@shared/domain/interface';
import { UserRepo } from '@shared/repo';
import { cleanupCollections } from '@shared/testing';
import { Logger } from '@src/core/logger';
import { KeycloakIdentityManagementService } from '@src/infra/identity-management/keycloak/service/keycloak-identity-management.service';
import { cleanupCollections } from '@testing/cleanup-collections';
import { v1 } from 'uuid';
import { Account, AccountSave } from '..';
import { AccountRepo } from '../../repo/micro-orm/account.repo';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ import { Test, TestingModule } from '@nestjs/testing';
import { AuthorizationError, EntityNotFoundError, ForbiddenOperationError, ValidationError } from '@shared/common';
import { User } from '@shared/domain/entity';
import { UserRepo } from '@shared/repo';
import { schoolEntityFactory, setupEntities, userFactory } from '@shared/testing';
import { Logger } from '@src/core/logger';
import { schoolEntityFactory } from '@testing/factory/school-entity.factory';
import { userFactory } from '@testing/factory/user.factory';
import { setupEntities } from '@testing/setup-entities';
import 'reflect-metadata';
import { Account, AccountSave, UpdateAccount } from '..';
import { AccountConfig } from '../../account-config';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { NotFoundError } from '@mikro-orm/core';
import { EntityManager, ObjectId } from '@mikro-orm/mongodb';
import { Test, TestingModule } from '@nestjs/testing';
import { User } from '@shared/domain/entity';
import { cleanupCollections, userFactory } from '@shared/testing';
import { cleanupCollections } from '@testing/cleanup-collections';
import { userFactory } from '@testing/factory/user.factory';
import { AccountEntity } from '../../domain/entity/account.entity';
import { accountDoFactory, accountFactory } from '../../testing';
import { AccountRepo } from './account.repo';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ObjectId } from '@mikro-orm/mongodb';
import { Account, AccountProps } from '@modules/account';
import { DomainObjectFactory } from '@shared/testing/factory/domainobject';
import { DomainObjectFactory } from '@testing/factory/domainobject';

export const accountDoFactory = DomainObjectFactory.define<Account, AccountProps>(Account, ({ sequence, params }) => {
return {
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/modules/account/testing/account.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { User } from '@shared/domain/entity';
import { EntityId } from '@shared/domain/types';

import { ObjectId } from '@mikro-orm/mongodb';
import { BaseFactory } from '@shared/testing/factory/base.factory';
import { AccountEntity, IdmAccountProperties } from '@src/modules/account/domain/entity/account.entity';
import { AccountEntity, IdmAccountProperties } from '@modules/account/domain/entity/account.entity';
import { BaseFactory } from '@testing/factory/base.factory';
import { DeepPartial } from 'fishery';

export const defaultTestPassword = 'DummyPasswd!1';
Expand Down
14 changes: 7 additions & 7 deletions apps/server/src/modules/alert/adapter/status.adapter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Test, TestingModule } from '@nestjs/testing';
import { HttpService } from '@nestjs/axios';
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { ConfigService } from '@nestjs/config';
import { ServerConfig } from '@modules/server';
import { axiosResponseFactory } from '@shared/testing';
import { of, throwError } from 'rxjs';
import { HttpService } from '@nestjs/axios';
import { ConfigService } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { axiosResponseFactory } from '@testing/factory/axios-response.factory';
import { AxiosError } from 'axios';
import { StatusAdapter } from './status.adapter';
import { ComponentDto, ComponentResponse, IncidentsResponse } from './dto';
import { of, throwError } from 'rxjs';
import { createComponent, createIncident } from '../testing';
import { ComponentDto, ComponentResponse, IncidentsResponse } from './dto';
import { StatusAdapter } from './status.adapter';

describe('StatusAdapter', () => {
const incidentsPath = '/api/v1/incidents';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { INestApplication } from '@nestjs/common';
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { HttpService } from '@nestjs/axios';
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import request from 'supertest';
import { of } from 'rxjs';
import { axiosResponseFactory } from '@shared/testing';
import { SchulcloudTheme } from '@shared/domain/types';
import { axiosResponseFactory } from '@testing/factory/axios-response.factory';
import { of } from 'rxjs';
import request from 'supertest';
import { serverConfig, ServerTestModule } from '../../../server';
import { ComponentDto, ComponentResponse, IncidentsResponse } from '../../adapter/dto';
import { createComponent, createIncident } from '../../testing';
import { AlertResponse } from '../dto';
import { ComponentDto, ComponentResponse, IncidentsResponse } from '../../adapter/dto';

describe('Alert Controller api', () => {
const alertPath = '/alert';
Expand Down
Loading

0 comments on commit 267083e

Please sign in to comment.