Skip to content

Commit

Permalink
Merge pull request #186 from mapeveri/feat/185
Browse files Browse the repository at this point in the history
Fix acceptance tests
  • Loading branch information
mapeveri authored Feb 7, 2025
2 parents b11c237 + 909236f commit 1e0c377
Show file tree
Hide file tree
Showing 10 changed files with 1,322 additions and 361 deletions.
2 changes: 1 addition & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ POSTGRESQL_DB_URL="postgresql://postgres:app123456@localhost:5435/languages_test
MONGO_DB_DATABASE=languages_test
MONGO_DB_URL=mongodb://localhost:27017/languages_test?replicaSet=rs0&directConnection=true
GOOGLE_CLIENT_ID=""
JWT_SECRET=""
JWT_SECRET="secret"
FRONTED_URL="http://localhost:3000"
RABBITMQ_DEFAULT_USER=app
RABBITMQ_DEFAULT_PASS=rabbit_app
Expand Down
1,644 changes: 1,298 additions & 346 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@nestjs/testing": "^10.4.6",
"@stryker-mutator/core": "^7.3.0",
"@stryker-mutator/jest-runner": "^7.3.0",
"@swc/core": "^1.10.14",
"@types/amqplib": "^0.10.4",
"@types/express": "^4.17.21",
"@types/glob": "^7.2.0",
Expand All @@ -40,6 +41,7 @@
"@types/uuid": "^9.0.7",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@vitest/coverage-v8": "^3.0.5",
"@vitest/ui": "^3.0.2",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.10.0",
Expand All @@ -52,7 +54,8 @@
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.7.2",
"vitest": "^3.0.2"
"unplugin-swc": "^1.5.1",
"vitest": "^3.0.5"
},
"dependencies": {
"@mikro-orm/cli": "^6.3.8",
Expand Down
4 changes: 2 additions & 2 deletions test/acceptance/account/auth/getUserAcceptance.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { beforeAll, describe, beforeEach, afterAll, it } from '@jest/globals';
import { beforeAll, describe, beforeEach, afterAll, it } from 'vitest';
import { INestApplication } from '@nestjs/common';
import request = require('supertest');
import request from 'supertest';
import { MikroORM } from '@mikro-orm/core';
import { createApplication, truncateTables } from '@test/acceptance/createApplication';
import { UserPrimitives } from '@src/account/domain/user/user';
Expand Down
4 changes: 2 additions & 2 deletions test/acceptance/account/auth/signUpAcceptance.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { beforeAll, describe, beforeEach, afterAll, it } from '@jest/globals';
import { beforeAll, describe, beforeEach, afterAll, it } from 'vitest';
import { INestApplication } from '@nestjs/common';
import request = require('supertest');
import request from 'supertest';
import { MikroORM } from '@mikro-orm/core';
import { createApplication, truncateTables } from '@test/acceptance/createApplication';

Expand Down
4 changes: 2 additions & 2 deletions test/acceptance/createApplication.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from '@jest/globals';
import { vi } from 'vitest';
import { Test, TestingModule } from '@nestjs/testing';
import { ConfigModule } from '@nestjs/config';
import { JwtService } from '@nestjs/jwt';
Expand Down Expand Up @@ -28,7 +28,7 @@ export async function createApplication() {
.useValue(mockAuthGuard)
.overrideProvider(JwtService)
.useValue({
verifyAsync: jest.fn().mockResolvedValue(user),
verifyAsync: vi.fn().mockResolvedValue(user),
})
.compile();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { beforeAll, describe, beforeEach, afterAll, it } from '@jest/globals';
import { beforeAll, describe, beforeEach, afterAll, it } from 'vitest';
import { INestApplication } from '@nestjs/common';
import request = require('supertest');
import request from 'supertest';
import { MikroORM } from '@mikro-orm/core';
import { createApplication, truncateTables } from '@test/acceptance/createApplication';
import CountryMother from '@test/unit/languages/domain/country/countryMother';
Expand Down
4 changes: 2 additions & 2 deletions test/acceptance/languages/term/getTermAcceptance.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { beforeAll, describe, beforeEach, afterAll, expect, it } from '@jest/globals';
import { beforeAll, describe, beforeEach, afterAll, expect, it } from 'vitest';
import { INestApplication } from '@nestjs/common';
import request = require('supertest');
import request from 'supertest';
import { MikroORM } from '@mikro-orm/core';
import { createApplication, truncateTables, USER_ID_LOGGED } from '@test/acceptance/createApplication';
import WordMother from '@test/unit/languages/domain/term/word/wordMother';
Expand Down
4 changes: 2 additions & 2 deletions test/acceptance/languages/term/updateWordAcceptance.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { beforeAll, describe, beforeEach, afterAll, it, expect } from '@jest/globals';
import { beforeAll, describe, beforeEach, afterAll, it, expect } from 'vitest';
import { INestApplication } from '@nestjs/common';
import request = require('supertest');
import request from 'supertest';
import { MikroORM } from '@mikro-orm/core';
import { createApplication, truncateTables, USER_ID_LOGGED } from '@test/acceptance/createApplication';
import WordMother from '@test/unit/languages/domain/term/word/wordMother';
Expand Down
8 changes: 7 additions & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import swc from 'unplugin-swc';
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
globals: true,
environment: 'node',
setupFiles: './test/setup.ts',
include: ['test/unit/**/*.test.ts', 'test/acceptance/**/*.test.ts'],
include: ['test/**/*.test.ts'],
alias: {
'@src': '/src',
'@test': '/test',
Expand All @@ -15,4 +16,9 @@ export default defineConfig({
reportsDirectory: './coverage',
},
},
plugins: [
swc.vite({
module: { type: 'es6' },
}),
],
});

0 comments on commit 1e0c377

Please sign in to comment.