test: comprehensive test suites and quality gates pass across backend, storefront and admin
- Backend (NestJS): 82 suites, 641 tests passing; 0 ESLint errors; 0 tsc errors. Hardened SSL cert/key matching, SSRF IP pinning, and eBank validation. - Admin Panel (Vite/React): 48 suites, 300 tests passing; 0 ESLint errors; 0 tsc errors. Full coverage across all pages and settings. - Storefront (Next.js): 62 suites, 368 tests passing; 0 ESLint errors; 0 tsc errors. - Fixed unmount lifecycle guards, promise error handling, and component edge cases.
This commit is contained in:
1 parent
1e73715169
commit
ddbf1ca026
439 files changed
+32911
-6107
No files matched your search
@@ -1,18 +1,18 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { AuthController } from './auth.controller';
|
||||
import { AuthService } from './auth.service';
|
||||
import { Test, TestingModule } from "@nestjs/testing";
|
||||
import { AuthController } from "./auth.controller";
|
||||
import { AuthService } from "./auth.service";
|
||||
|
||||
describe('AuthController', () => {
|
||||
describe("AuthController", () => {
|
||||
let controller: AuthController;
|
||||
let service: AuthService;
|
||||
|
||||
const mockAuthService = {
|
||||
sendOtp: jest
|
||||
.fn()
|
||||
.mockResolvedValue({ success: true, message: 'کد تایید ارسال شد' }),
|
||||
.mockResolvedValue({ success: true, message: "کد تایید ارسال شد" }),
|
||||
verifyOtp: jest
|
||||
.fn()
|
||||
.mockResolvedValue({ success: true, data: { accessToken: 'token' } }),
|
||||
.mockResolvedValue({ success: true, data: { accessToken: "token" } }),
|
||||
};
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -29,21 +29,21 @@ describe('AuthController', () => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
it("should be defined", () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
|
||||
it('should call sendOtp on service', async () => {
|
||||
const dto = { phoneNumber: '09123456789' };
|
||||
it("should call sendOtp on service", async () => {
|
||||
const dto = { phoneNumber: "09123456789" };
|
||||
const result = await controller.sendOtp(dto);
|
||||
expect(service.sendOtp).toHaveBeenCalledWith(dto);
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
|
||||
it('should call verifyOtp on service', async () => {
|
||||
const dto = { phoneNumber: '09123456789', code: '12345' };
|
||||
it("should call verifyOtp on service", async () => {
|
||||
const dto = { phoneNumber: "09123456789", code: "12345" };
|
||||
const result = await controller.verifyOtp(dto);
|
||||
expect(service.verifyOtp).toHaveBeenCalledWith(dto);
|
||||
expect(result.data.accessToken).toBe('token');
|
||||
expect(result.data.accessToken).toBe("token");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user