Skip to content

Commit

Permalink
refactor: Add new unit folder
Browse files Browse the repository at this point in the history
  • Loading branch information
mapeveri committed Mar 12, 2024
1 parent f1dd17b commit 59ab4e4
Show file tree
Hide file tree
Showing 53 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
- name: Run format-code check
run: npm run format-code-check
- name: Run tests
run: npm run test
run: npm run test:unit
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"linter-check": "eslint 'src/**/*.ts'",
"linter-fix": "eslint --fix 'src/**/*.ts'",
"typeorm": "ts-node --require tsconfig-paths/register -r dotenv/config -r ts-node/register/transpile-only ./node_modules/typeorm/cli.js -d src/shared/infrastructure/persistence/typeOrm/dataSource.ts ",
"test": "jest",
"test:unit": "jest --testPathPattern=test/unit",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { beforeEach, describe, expect, it, jest } from '@jest/globals';
import LoginUserCommandHandler from '@src/languages/application/auth/command/loginUser/loginUserCommandHandler';
import { LoginUserCommandMother } from './loginUserCommandMother';
import LoginException from '@src/languages/domain/user/loginException';
import { EventBusMock } from '@test/shared/domain/buses/eventBus/eventBusMock';
import { AuthSessionCreatedEventMother } from '@test/languages/domain/auth/authSessionCreatedEventMother';
import { AuthSessionRepositoryMock } from '@test/languages/domain/auth/authSessionRepositoryMock';
import { AuthSessionMother } from '@test/languages/domain/auth/authSessionMother';
import { AuthSessionIdMother } from '@test/languages/domain/auth/authSessionIdMother';
import { SessionMother } from '@test/languages/domain/auth/sessionMother';
import { SocialAuthenticatorMock } from '@test/languages/domain/auth/socialAuthenticatorMock';
import { AuthSessionRepositoryMock } from '@test/unit/languages/domain/auth/authSessionRepositoryMock';
import { SocialAuthenticatorMock } from '@test/unit/languages/domain/auth/socialAuthenticatorMock';
import { EventBusMock } from '@test/unit/shared/domain/buses/eventBus/eventBusMock';
import { AuthSessionMother } from '@test/unit/languages/domain/auth/authSessionMother';
import { AuthSessionIdMother } from '@test/unit/languages/domain/auth/authSessionIdMother';
import { SessionMother } from '@test/unit/languages/domain/auth/sessionMother';
import { AuthSessionCreatedEventMother } from '@test/unit/languages/domain/auth/authSessionCreatedEventMother';

describe('LoginUserCommandHandler', () => {
let repository: AuthSessionRepositoryMock;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { beforeEach, describe, expect, it } from '@jest/globals';
import CreateCountryCommandHandler from '@src/languages/application/country/command/create/createCountryCommandHandler';
import Country from '@src/languages/domain/country/country';
import { CountryRepositoryMock } from '@test/languages/domain/country/countryRepositoryMock';
import CountryMother from '@test/languages/domain/country/countryMother';
import { CreateCountryCommandMother } from './createCountryCommandMother';
import { CountryRepositoryMock } from '@test/unit/languages/domain/country/countryRepositoryMock';
import { EventBusMock } from '@test/unit/shared/domain/buses/eventBus/eventBusMock';
import CountryMother from '@test/unit/languages/domain/country/countryMother';
import { CreateCountryCommandMother } from '@test/unit/languages/application/country/command/create/createCountryCommandMother';
import CountryAlreadyExistsException from '@src/languages/domain/country/countryAlreadyExistsException';
import { EventBusMock } from '@test/shared/domain/buses/eventBus/eventBusMock';
import { CountryCreatedEventMother } from '@test/languages/domain/country/countryCreatedEventMother';
import { CountryCreatedEventMother } from '@test/unit/languages/domain/country/countryCreatedEventMother';

describe('CreateCountryCommandHandler', () => {
let eventBus: EventBusMock;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { beforeEach, describe, expect, it } from '@jest/globals';
import { FindCountryQueryMother } from './findCountryQueryMother';
import FindCountryQueryHandler from '@src/languages/application/country/query/find/findCountryQueryHandler';
import { CountryRepositoryMock } from '@test/languages/domain/country/countryRepositoryMock';
import CountryMother from '@test/languages/domain/country/countryMother';
import { CountryRepositoryMock } from '@test/unit/languages/domain/country/countryRepositoryMock';
import { CountryIdMother } from '@test/unit/languages/domain/country/countryIdMother';
import Country from '@src/languages/domain/country/country';
import { CountryIdMother } from '@test/languages/domain/country/countryIdMother';
import CountryMother from '@test/unit/languages/domain/country/countryMother';

describe('FindCountryQueryHandler', () => {
let countryRepository: CountryRepositoryMock;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { beforeEach, describe, expect, it } from '@jest/globals';
import { CountryRepositoryMock } from '@test/languages/domain/country/countryRepositoryMock';
import CountryMother from '@test/languages/domain/country/countryMother';
import Country from '@src/languages/domain/country/country';
import { FindCountriesQueryMother } from './findCountriesQueryMother';
import FindCountriesQueryHandler from '@src/languages/application/country/query/findAll/findCountriesQueryHandler';
import { CountryRepositoryMock } from '@test/unit/languages/domain/country/countryRepositoryMock';
import CountryMother from '@test/unit/languages/domain/country/countryMother';

describe('FindCountryQueryHandler', () => {
let countryRepository: CountryRepositoryMock;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
import { EventBusMock } from '@test/shared/domain/buses/eventBus/eventBusMock';
import { UserIdMother } from '@test/languages/domain/user/userIdMother';
import { EventBusMock } from '@test/unit/shared/domain/buses/eventBus/eventBusMock';
import { TermRepositoryMock } from '@test/unit/languages/domain/term/termRepositoryMock';
import CreateExpressionCommandHandler from '@src/languages/application/term/command/create/createExpressionCommandHandler';
import { CreateExpressionCommandMother } from './createExpressionCommandMother';
import ExpressionMother from '@test/languages/domain/term/expression/expressionMother';
import Expression from '@src/languages/domain/term/expression/expression';
import { ExpressionCreatedEventMother } from '@test/languages/domain/term/expression/expressionCreatedEventMother';
import ExpressionMother from '@test/unit/languages/domain/term/expression/expressionMother';
import { CreateExpressionCommandMother } from '@test/unit/languages/application/term/command/create/createExpressionCommandMother';
import ExpressionAlreadyExistsException from '@src/languages/domain/term/expression/expressionAlreadyExistsException';
import { TermRepositoryMock } from '@test/languages/domain/term/termRepositoryMock';
import { UserIdMother } from '@test/unit/languages/domain/user/userIdMother';
import Expression from '@src/languages/domain/term/expression/expression';
import { ExpressionCreatedEventMother } from '@test/unit/languages/domain/term/expression/expressionCreatedEventMother';

describe('CreateExpressionCommandHandler', () => {
let eventBus: EventBusMock;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
import CreateWordCommandHandler from '@src/languages/application/term/command/create/createWordCommandHandler';
import { EventBusMock } from '@test/shared/domain/buses/eventBus/eventBusMock';
import { CreateWordCommandMother } from './createWordCommandMother';
import WordMother from '@test/languages/domain/term/word/wordMother';
import Word from '@src/languages/domain/term/word/word';
import { WordCreatedEventMother } from '@test/languages/domain/term/word/wordCreatedEventMother';
import { UserIdMother } from '@test/languages/domain/user/userIdMother';
import { TermRepositoryMock } from '@test/unit/languages/domain/term/termRepositoryMock';
import { EventBusMock } from '@test/unit/shared/domain/buses/eventBus/eventBusMock';
import WordMother from '@test/unit/languages/domain/term/word/wordMother';
import { CreateWordCommandMother } from '@test/unit/languages/application/term/command/create/createWordCommandMother';
import WordAlreadyExistsException from '@src/languages/domain/term/word/wordAlreadyExistsException';
import { TermRepositoryMock } from '@test/languages/domain/term/termRepositoryMock';
import { UserIdMother } from '@test/unit/languages/domain/user/userIdMother';
import Word from '@src/languages/domain/term/word/word';
import { WordCreatedEventMother } from '@test/unit/languages/domain/term/word/wordCreatedEventMother';

describe('CreateWordCommandHandler', () => {
let eventBus: EventBusMock;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { beforeEach, describe, it } from '@jest/globals';
import ExpressionMother from '@test/languages/domain/term/expression/expressionMother';
import DeleteExpressionCommandHandler from '@src/languages/application/term/command/delete/deleteExpressionCommandHandler';
import { DeleteExpressionCommandMother } from './deleteExpressionCommandMother';
import { TermRepositoryMock } from '@test/languages/domain/term/termRepositoryMock';
import { TermRepositoryMock } from '@test/unit/languages/domain/term/termRepositoryMock';
import ExpressionMother from '@test/unit/languages/domain/term/expression/expressionMother';
import { DeleteExpressionCommandMother } from '@test/unit/languages/application/term/command/delete/deleteExpressionCommandMother';

describe('DeleteExpressionCommandHandler', () => {
let termRepository: TermRepositoryMock;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { beforeEach, describe, it } from '@jest/globals';
import DeleteWordCommandHandler from '@src/languages/application/term/command/delete/deleteWordCommandHandler';
import WordMother from '@test/languages/domain/term/word/wordMother';
import { DeleteWordCommandMother } from './deleteWordCommandMother';
import { TermRepositoryMock } from '@test/languages/domain/term/termRepositoryMock';
import { TermRepositoryMock } from '@test/unit/languages/domain/term/termRepositoryMock';
import WordMother from '@test/unit/languages/domain/term/word/wordMother';
import { DeleteWordCommandMother } from '@test/unit/languages/application/term/command/delete/deleteWordCommandMother';

describe('DeleteWordCommandHandler', () => {
let termRepository: TermRepositoryMock;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { beforeEach, describe, expect, it } from '@jest/globals';
import { SearchTermQueryMother } from './searchTermQueryMother';
import SearchTermQueryHandler from '@src/languages/application/term/query/search/searchTermQueryHandler';
import { TermViewMother } from '@test/languages/application/term/query/viewModel/termViewMother';
import { SearchTermViewReadLayerMock } from '@test/unit/languages/application/term/query/search/searchTermViewReadLayerMock';
import { TermView } from '@src/languages/application/term/viewModel/termView';
import { SearchTermViewReadLayerMock } from '@test/languages/application/term/query/search/searchTermViewReadLayerMock';
import { TermViewMother } from '@test/unit/languages/application/term/query/viewModel/termViewMother';

describe('SearchTermQueryHandler', () => {
let termRepository: SearchTermViewReadLayerMock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import SearchTermViewReadLayer, {
} from '@src/languages/application/term/query/search/searchTermViewReadLayer';

export class SearchTermViewReadLayerMock implements SearchTermViewReadLayer {
private searchMock: jest.Mock;
private saveMock: jest.Mock;
private terms: TermView[];
private readonly searchMock: jest.Mock;
private readonly saveMock: jest.Mock;
private readonly terms: TermView[];

constructor() {
this.searchMock = jest.fn();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { beforeEach, describe, expect, it } from '@jest/globals';
import { TermViewMother } from '@test/languages/application/term/query/viewModel/termViewMother';
import { FindSuggestionsTermReadLayerMock } from '@test/unit/languages/application/term/query/suggestion/findSuggestionsTermReadLayerMock';
import FindSuggestionsTermQueryHandler from '@src/languages/application/term/query/suggestion/findSuggestionsTermQueryHandler';
import { FindSuggestionsTermQueryMother } from '@test/languages/application/term/query/suggestion/findSuggestionsTermQueryMother';
import { FindSuggestionsTermReadLayerMock } from '@test/languages/application/term/query/suggestion/findSuggestionsTermReadLayerMock';
import { FindSuggestionsTermQueryMother } from '@test/unit/languages/application/term/query/suggestion/findSuggestionsTermQueryMother';
import { TermViewMother } from '@test/unit/languages/application/term/query/viewModel/termViewMother';

describe('FindSuggestionsTermQueryHandler', () => {
let findSuggestionTermReadLayerMock: FindSuggestionsTermReadLayerMock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import FindSuggestionsTermReadLayer from '@src/languages/application/term/query/

export class FindSuggestionsTermReadLayerMock implements FindSuggestionsTermReadLayer {
private readonly findMock: jest.Mock;
private terms: TermView[];
private readonly terms: TermView[];

constructor() {
this.findMock = jest.fn();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TermView } from '@src/languages/application/term/viewModel/termView';
import faker from 'faker';
import TermTypeMother from '../../../../domain/term/termTypeMother';
import TermTypeMother from '@test/unit/languages/domain/term/termTypeMother';

export class TermViewMother {
static random(props?: Partial<TermView>): TermView {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AuthSessionIdMother } from './authSessionIdMother';
import AuthSession from '@src/languages/domain/auth/authSession';
import AuthSession from '../../../../../src/languages/domain/auth/authSession';
import AuthSessionId from '@src/languages/domain/auth/authSessionId';
import { SessionMother } from './sessionMother';
import Session from '@src/languages/domain/auth/session';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import faker from 'faker';
import Session from '@src/languages/domain/auth/session';
import Session from '../../../../../src/languages/domain/auth/session';

export interface AuthSessionMotherProps {
token?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import CountryId from '@src/languages/domain/country/countryId';
import ExpressionTermCollection from '@src/languages/domain/term/expression/expressionTermCollection';
import { UserIdMother } from '../../user/userIdMother';
import TermId from '@src/languages/domain/term/termId';
import { TermIdMother } from '@test/languages/domain/term/termIdMother';
import TermType, { TermTypeEnum } from '@src/languages/domain/term/termType';
import { TermIdMother } from '@test/unit/languages/domain/term/termIdMother';

interface ExpressionMotherProps {
id?: TermId;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import WordTermCollection from '@src/languages/domain/term/word/wordTermCollecti
import { UserIdMother } from '../../user/userIdMother';
import faker from 'faker';
import TermId from '@src/languages/domain/term/termId';
import { TermIdMother } from '@test/languages/domain/term/termIdMother';
import TermType, { TermTypeEnum } from '@src/languages/domain/term/termType';
import { TermIdMother } from '@test/unit/languages/domain/term/termIdMother';

interface WordMotherProps {
id?: TermId;
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 59ab4e4

Please sign in to comment.