Skip to content

Commit c48154b

Browse files
authored
Merge pull request #67 from Code-4-Community/dependabot/npm_and_yarn/nx/jest-22.4.4
Bump @nx/jest from 22.0.2 to 22.4.4
2 parents 943b574 + 738a2e7 commit c48154b

3 files changed

Lines changed: 250 additions & 15 deletions

File tree

apps/backend/src/donations/donations.controller.spec.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import {
1111
import { Donation as DomainDonation } from './mappers';
1212
import { INestApplication, BadRequestException } from '@nestjs/common';
1313
import request from 'supertest';
14+
import { AuthService } from '../auth/auth.service';
15+
import { UsersService } from '../users/users.service';
1416
describe('DonationsController', () => {
1517
let controller: DonationsController;
1618
let service: DonationsService;
@@ -41,6 +43,16 @@ describe('DonationsController', () => {
4143
findPaginated: jest.fn(),
4244
};
4345

46+
const mockAuthService = {
47+
getUser: jest
48+
.fn()
49+
.mockResolvedValue([{ Name: 'email', Value: 'test@example.com' }]),
50+
};
51+
52+
const mockUsersService = {
53+
find: jest.fn().mockResolvedValue([]),
54+
};
55+
4456
beforeEach(async () => {
4557
const module: TestingModule = await Test.createTestingModule({
4658
controllers: [DonationsController],
@@ -53,6 +65,14 @@ describe('DonationsController', () => {
5365
provide: DonationsRepository,
5466
useValue: mockRepository,
5567
},
68+
{
69+
provide: AuthService,
70+
useValue: mockAuthService,
71+
},
72+
{
73+
provide: UsersService,
74+
useValue: mockUsersService,
75+
},
5676
],
5777
}).compile();
5878

@@ -409,11 +429,23 @@ describe('Donation Integration', () => {
409429
}),
410430
};
411431

432+
const mockAuthServiceIntegration = {
433+
getUser: jest
434+
.fn()
435+
.mockResolvedValue([{ Name: 'email', Value: 'test@example.com' }]),
436+
};
437+
438+
const mockUsersServiceIntegration = {
439+
find: jest.fn().mockResolvedValue([]),
440+
};
441+
412442
const moduleFixture: TestingModule = await Test.createTestingModule({
413443
controllers: [DonationsController],
414444
providers: [
415445
{ provide: DonationsService, useValue: mockService },
416446
{ provide: DonationsRepository, useValue: {} },
447+
{ provide: AuthService, useValue: mockAuthServiceIntegration },
448+
{ provide: UsersService, useValue: mockUsersServiceIntegration },
417449
],
418450
}).compile();
419451

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"@nestjs/testing": "^10.0.2",
7878
"@nx/cypress": "22.0.2",
7979
"@nx/eslint-plugin": "22.0.2",
80-
"@nx/jest": "22.0.2",
80+
"@nx/jest": "22.4.4",
8181
"@nx/react": "22.0.2",
8282
"@nx/vite": "22.0.2",
8383
"@nx/webpack": "22.0.2",

0 commit comments

Comments
 (0)