From cd9399d27673a543570b2920f5415dbe7eba2d03 Mon Sep 17 00:00:00 2001 From: wolfganggreschus Date: Thu, 23 Nov 2023 12:38:03 +0100 Subject: [PATCH] adjusted tests --- .../authentication/strategy/ldap.strategy.spec.ts | 3 ++- .../controller/api-test/card-create.api.spec.ts | 2 +- .../api-test/card-update-height.api.spec.ts | 5 +++-- .../api-test/card-update-title.api.spec.ts | 9 +++++---- .../board/repo/board-do.builder-impl.spec.ts | 3 ++- .../src/modules/board/repo/board-do.repo.spec.ts | 13 +++---------- .../board-do-copy.service.spec.ts | 12 ++++++------ .../recursive-copy.visitor.spec.ts | 2 +- .../board-do-copy-service/recursive-copy.visitor.ts | 1 + .../task/controller/api-test/task.api.spec.ts | 11 ++++++----- .../auto-context-name.strategy.spec.ts | 3 ++- .../shared/repo/base.do.repo.integration.spec.ts | 3 ++- .../shared/repo/news/news.repo.integration.spec.ts | 11 ++++++----- 13 files changed, 40 insertions(+), 38 deletions(-) diff --git a/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts b/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts index b3067de04eb..3d8148b024e 100644 --- a/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts +++ b/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts @@ -3,7 +3,8 @@ import { AccountDto } from '@modules/account/services/dto'; import { UnauthorizedException } from '@nestjs/common'; import { PassportModule } from '@nestjs/passport'; import { Test, TestingModule } from '@nestjs/testing'; -import { LegacySchoolDo, RoleName, SystemEntity, User } from '@shared/domain'; +import { RoleName, SystemEntity, User } from '@shared/domain'; +import { LegacySchoolDo } from '@shared/domain/domainobject'; import { LegacySchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; import { accountDtoFactory, diff --git a/apps/server/src/modules/board/controller/api-test/card-create.api.spec.ts b/apps/server/src/modules/board/controller/api-test/card-create.api.spec.ts index de006926e8f..fb1a5f0aeb9 100644 --- a/apps/server/src/modules/board/controller/api-test/card-create.api.spec.ts +++ b/apps/server/src/modules/board/controller/api-test/card-create.api.spec.ts @@ -5,7 +5,7 @@ import { ServerTestModule } from '@modules/server/server.module'; import { ExecutionContext, INestApplication } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; import { ApiValidationError } from '@shared/common'; -import { BoardExternalReferenceType, ContentElementType } from '@shared/domain'; +import { BoardExternalReferenceType, ContentElementType } from '@shared/domain/domainobject'; import { cleanupCollections, columnBoardNodeFactory, diff --git a/apps/server/src/modules/board/controller/api-test/card-update-height.api.spec.ts b/apps/server/src/modules/board/controller/api-test/card-update-height.api.spec.ts index 2d4ab15b365..642a7dfd4c8 100644 --- a/apps/server/src/modules/board/controller/api-test/card-update-height.api.spec.ts +++ b/apps/server/src/modules/board/controller/api-test/card-update-height.api.spec.ts @@ -1,7 +1,9 @@ import { EntityManager } from '@mikro-orm/mongodb'; +import { ServerTestModule } from '@modules/server/server.module'; import { INestApplication } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { BoardExternalReferenceType, CardNode } from '@shared/domain'; +import { CardNode } from '@shared/domain'; +import { BoardExternalReferenceType } from '@shared/domain/domainobject'; import { TestApiClient, UserAndAccountTestFactory, @@ -11,7 +13,6 @@ import { columnNodeFactory, courseFactory, } from '@shared/testing'; -import { ServerTestModule } from '@modules/server/server.module'; describe(`card update height (api)`, () => { let app: INestApplication; diff --git a/apps/server/src/modules/board/controller/api-test/card-update-title.api.spec.ts b/apps/server/src/modules/board/controller/api-test/card-update-title.api.spec.ts index bc598d69051..79873cab92f 100644 --- a/apps/server/src/modules/board/controller/api-test/card-update-title.api.spec.ts +++ b/apps/server/src/modules/board/controller/api-test/card-update-title.api.spec.ts @@ -1,17 +1,18 @@ import { EntityManager } from '@mikro-orm/mongodb'; +import { ServerTestModule } from '@modules/server/server.module'; import { INestApplication } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { BoardExternalReferenceType, CardNode } from '@shared/domain'; +import { CardNode } from '@shared/domain'; +import { BoardExternalReferenceType } from '@shared/domain/domainobject'; import { + TestApiClient, + UserAndAccountTestFactory, cardNodeFactory, cleanupCollections, columnBoardNodeFactory, columnNodeFactory, courseFactory, - TestApiClient, - UserAndAccountTestFactory, } from '@shared/testing'; -import { ServerTestModule } from '@modules/server/server.module'; const baseRouteName = '/cards'; diff --git a/apps/server/src/modules/board/repo/board-do.builder-impl.spec.ts b/apps/server/src/modules/board/repo/board-do.builder-impl.spec.ts index 8bbc859fa17..3b6179fcf23 100644 --- a/apps/server/src/modules/board/repo/board-do.builder-impl.spec.ts +++ b/apps/server/src/modules/board/repo/board-do.builder-impl.spec.ts @@ -1,4 +1,5 @@ -import { BoardNodeType, ExternalToolElement, LinkElement } from '@shared/domain'; +import { BoardNodeType } from '@shared/domain'; +import { ExternalToolElement, LinkElement } from '@shared/domain/domainobject'; import { cardNodeFactory, columnBoardNodeFactory, diff --git a/apps/server/src/modules/board/repo/board-do.repo.spec.ts b/apps/server/src/modules/board/repo/board-do.repo.spec.ts index 2f9a6633e69..54a12bcfe5a 100644 --- a/apps/server/src/modules/board/repo/board-do.repo.spec.ts +++ b/apps/server/src/modules/board/repo/board-do.repo.spec.ts @@ -1,20 +1,13 @@ import { createMock } from '@golevelup/ts-jest'; +import { MongoMemoryDatabaseModule } from '@infra/database'; import { NotFoundError } from '@mikro-orm/core'; import { EntityManager } from '@mikro-orm/mongodb'; import { FilesStorageClientAdapterService } from '@modules/files-storage-client'; import { ContextExternalToolService } from '@modules/tool/context-external-tool/service'; import { NotFoundException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { - AnyBoardDo, - BoardExternalReferenceType, - Card, - CardNode, - Column, - ColumnBoard, - RichTextElementNode, -} from '@shared/domain'; -import { MongoMemoryDatabaseModule } from '@infra/database'; +import { CardNode, RichTextElementNode } from '@shared/domain'; +import { AnyBoardDo, BoardExternalReferenceType, Card, Column, ColumnBoard } from '@shared/domain/domainobject'; import { cardFactory, cardNodeFactory, diff --git a/apps/server/src/modules/board/service/board-do-copy-service/board-do-copy.service.spec.ts b/apps/server/src/modules/board/service/board-do-copy-service/board-do-copy.service.spec.ts index 40a62ede2ed..33f374b527e 100644 --- a/apps/server/src/modules/board/service/board-do-copy-service/board-do-copy.service.spec.ts +++ b/apps/server/src/modules/board/service/board-do-copy-service/board-do-copy.service.spec.ts @@ -1,4 +1,6 @@ import { createMock } from '@golevelup/ts-jest'; +import { FileRecordParentType } from '@infra/rabbitmq'; +import { CopyElementType, CopyStatus, CopyStatusEnum } from '@modules/copy-helper'; import { Test, TestingModule } from '@nestjs/testing'; import { Card, @@ -6,6 +8,9 @@ import { ColumnBoard, ExternalToolElement, FileElement, + LinkElement, + RichTextElement, + SubmissionContainerElement, isCard, isColumn, isColumnBoard, @@ -14,11 +19,7 @@ import { isLinkElement, isRichTextElement, isSubmissionContainerElement, - LinkElement, - RichTextElement, - SubmissionContainerElement, -} from '@shared/domain'; -import { FileRecordParentType } from '@infra/rabbitmq'; +} from '@shared/domain/domainobject'; import { cardFactory, columnBoardFactory, @@ -31,7 +32,6 @@ import { submissionContainerElementFactory, submissionItemFactory, } from '@shared/testing'; -import { CopyElementType, CopyStatus, CopyStatusEnum } from '@modules/copy-helper'; import { ObjectId } from 'bson'; import { BoardDoCopyService } from './board-do-copy.service'; import { SchoolSpecificFileCopyService } from './school-specific-file-copy.interface'; diff --git a/apps/server/src/modules/board/service/board-do-copy-service/recursive-copy.visitor.spec.ts b/apps/server/src/modules/board/service/board-do-copy-service/recursive-copy.visitor.spec.ts index bb0a7fda403..3fe6c7b6cbe 100644 --- a/apps/server/src/modules/board/service/board-do-copy-service/recursive-copy.visitor.spec.ts +++ b/apps/server/src/modules/board/service/board-do-copy-service/recursive-copy.visitor.spec.ts @@ -1,6 +1,6 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; -import { LinkElement } from '@shared/domain'; +import { LinkElement } from '@shared/domain/domainobject'; import { linkElementFactory, setupEntities } from '@shared/testing'; import { CopyFileDto } from '@src/modules/files-storage-client/dto'; diff --git a/apps/server/src/modules/board/service/board-do-copy-service/recursive-copy.visitor.ts b/apps/server/src/modules/board/service/board-do-copy-service/recursive-copy.visitor.ts index d5396c5127a..5361154b7e7 100644 --- a/apps/server/src/modules/board/service/board-do-copy-service/recursive-copy.visitor.ts +++ b/apps/server/src/modules/board/service/board-do-copy-service/recursive-copy.visitor.ts @@ -13,6 +13,7 @@ import { SubmissionItem, } from '@shared/domain/domainobject'; import { LinkElement } from '@shared/domain/domainobject/board/link-element.do'; +import { EntityId } from '@shared/domain/types'; import { ObjectId } from 'bson'; import { SchoolSpecificFileCopyService } from './school-specific-file-copy.interface'; diff --git a/apps/server/src/modules/task/controller/api-test/task.api.spec.ts b/apps/server/src/modules/task/controller/api-test/task.api.spec.ts index b7afee9c257..a3d1f7e6b30 100644 --- a/apps/server/src/modules/task/controller/api-test/task.api.spec.ts +++ b/apps/server/src/modules/task/controller/api-test/task.api.spec.ts @@ -1,17 +1,18 @@ import { EntityManager } from '@mikro-orm/mongodb'; +import { ServerTestModule } from '@modules/server/server.module'; +import { TaskListResponse } from '@modules/task/controller/dto'; import { INestApplication } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { InputFormat, Permission } from '@shared/domain'; +import { Permission } from '@shared/domain'; +import { InputFormat } from '@shared/domain/types'; import { - TestApiClient, - UserAndAccountTestFactory, cleanupCollections, courseFactory, submissionFactory, taskFactory, + TestApiClient, + UserAndAccountTestFactory, } from '@shared/testing'; -import { ServerTestModule } from '@modules/server/server.module'; -import { TaskListResponse } from '@modules/task/controller/dto'; const tomorrow = new Date(Date.now() + 86400000); diff --git a/apps/server/src/modules/tool/tool-launch/service/auto-parameter-strategy/auto-context-name.strategy.spec.ts b/apps/server/src/modules/tool/tool-launch/service/auto-parameter-strategy/auto-context-name.strategy.spec.ts index caa02d1c69b..7c8d15f7627 100644 --- a/apps/server/src/modules/tool/tool-launch/service/auto-parameter-strategy/auto-context-name.strategy.spec.ts +++ b/apps/server/src/modules/tool/tool-launch/service/auto-parameter-strategy/auto-context-name.strategy.spec.ts @@ -3,7 +3,8 @@ import { ObjectId } from '@mikro-orm/mongodb'; import { ColumnBoardService, ContentElementService } from '@modules/board'; import { CourseService } from '@modules/learnroom'; import { Test, TestingModule } from '@nestjs/testing'; -import { BoardExternalReferenceType, ColumnBoard, Course, ExternalToolElement } from '@shared/domain'; +import { Course } from '@shared/domain/'; +import { BoardExternalReferenceType, ColumnBoard, ExternalToolElement } from '@shared/domain/domainobject'; import { columnBoardFactory, contextExternalToolFactory, diff --git a/apps/server/src/shared/repo/base.do.repo.integration.spec.ts b/apps/server/src/shared/repo/base.do.repo.integration.spec.ts index b9683fbf1ea..774631dfca0 100644 --- a/apps/server/src/shared/repo/base.do.repo.integration.spec.ts +++ b/apps/server/src/shared/repo/base.do.repo.integration.spec.ts @@ -4,9 +4,10 @@ import { Entity, EntityName, Property } from '@mikro-orm/core'; import { EntityManager, ObjectId } from '@mikro-orm/mongodb'; import { Injectable } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { BaseDO, BaseEntityWithTimestamps } from '@shared/domain'; +import { BaseEntityWithTimestamps } from '@shared/domain'; import { BaseDORepo } from '@shared/repo/base.do.repo'; import { LegacyLogger } from '@src/core/logger'; +import { BaseDO } from '@src/shared/domain/domainobject'; describe('BaseDORepo', () => { @Entity() diff --git a/apps/server/src/shared/repo/news/news.repo.integration.spec.ts b/apps/server/src/shared/repo/news/news.repo.integration.spec.ts index d68e50e0df1..143079a1fd1 100644 --- a/apps/server/src/shared/repo/news/news.repo.integration.spec.ts +++ b/apps/server/src/shared/repo/news/news.repo.integration.spec.ts @@ -1,15 +1,16 @@ +import { MongoMemoryDatabaseModule } from '@infra/database'; import { NotFoundError } from '@mikro-orm/core'; import { EntityManager, ObjectId } from '@mikro-orm/mongodb'; import { Test, TestingModule } from '@nestjs/testing'; -import { News, NewsTargetModel, SortOrder } from '@shared/domain'; -import { MongoMemoryDatabaseModule } from '@infra/database'; +import { News, SortOrder } from '@shared/domain'; +import { NewsTargetModel } from '@shared/domain/types'; import { - courseNewsFactory, - schoolNewsFactory, - teamNewsFactory, cleanupCollections, + courseNewsFactory, courseUnpublishedNewsFactory, + schoolNewsFactory, schoolUnpublishedNewsFactory, + teamNewsFactory, teamUnpublishedNewsFactory, userFactory, } from '@shared/testing';