Skip to content

Commit

Permalink
adjusted tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfganggreschus committed Nov 23, 2023
1 parent 14f03ce commit cd9399d
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
13 changes: 3 additions & 10 deletions apps/server/src/modules/board/repo/board-do.repo.spec.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
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,
Column,
ColumnBoard,
ExternalToolElement,
FileElement,
LinkElement,
RichTextElement,
SubmissionContainerElement,
isCard,
isColumn,
isColumnBoard,
Expand All @@ -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,
Expand All @@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion apps/server/src/shared/repo/base.do.repo.integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
11 changes: 6 additions & 5 deletions apps/server/src/shared/repo/news/news.repo.integration.spec.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down

0 comments on commit cd9399d

Please sign in to comment.