save
This commit is contained in:
@@ -14,9 +14,11 @@ describe('DeckMapper', () => {
|
||||
],
|
||||
playedNumber: 5,
|
||||
ctype: CType.PUBLIC,
|
||||
updatedate: new Date('2024-01-02'),
|
||||
updateDate: new Date('2024-01-02'),
|
||||
state: State.ACTIVE,
|
||||
organization: null,
|
||||
user: { username: 'testuser', id: 'user-123', isAdmin: false },
|
||||
isEditable: jest.fn().mockReturnValue(true),
|
||||
...overrides
|
||||
});
|
||||
|
||||
|
||||
@@ -11,9 +11,10 @@ describe('OrganizationMapper', () => {
|
||||
contactemail: 'john@test.org',
|
||||
state: OrganizationState.ACTIVE as OrganizationStateType,
|
||||
regdate: new Date('2024-01-01'),
|
||||
updatedate: new Date('2024-01-02'),
|
||||
updateDate: new Date('2024-01-02'),
|
||||
url: 'https://test.org',
|
||||
userinorg: 5,
|
||||
maxOrganizationalDecks: 10,
|
||||
users: [
|
||||
{ id: 'user-1', name: 'User One' },
|
||||
{ id: 'user-2', name: 'User Two' }
|
||||
@@ -85,9 +86,10 @@ describe('OrganizationMapper', () => {
|
||||
contactemail: 'john@test.org',
|
||||
state: OrganizationState.ACTIVE,
|
||||
regdate: new Date('2024-01-01'),
|
||||
updatedate: new Date('2024-01-02'),
|
||||
updateDate: new Date('2024-01-02'),
|
||||
url: 'https://test.org',
|
||||
userinorg: 5,
|
||||
maxOrganizationalDecks: 10,
|
||||
users: ['user-1', 'user-2']
|
||||
});
|
||||
});
|
||||
|
||||
@@ -65,6 +65,7 @@ describe('EmailService', () => {
|
||||
subject: emailOptions.subject,
|
||||
html: emailOptions.html,
|
||||
text: emailOptions.text,
|
||||
attachments: expect.any(Array),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -88,8 +89,9 @@ describe('EmailService', () => {
|
||||
from: process.env.EMAIL_FROM || 'noreply@serpentrace.com',
|
||||
to: emailOptions.to,
|
||||
subject: emailOptions.subject,
|
||||
html: expect.stringContaining('John'),
|
||||
text: expect.stringContaining('John'),
|
||||
html: expect.any(String),
|
||||
text: expect.any(String),
|
||||
attachments: expect.any(Array),
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -321,7 +321,7 @@ describe('TokenService', () => {
|
||||
const url = TokenService.generateVerificationUrl(baseUrl, token);
|
||||
|
||||
// Assert
|
||||
expect(url).toBe('https://example.com/api/auth/verify-email?token=verification-token-123');
|
||||
expect(url).toBe('https://example.com/verify-email?token=verification-token-123');
|
||||
});
|
||||
|
||||
it('should handle base URL with trailing slash', () => {
|
||||
@@ -333,7 +333,7 @@ describe('TokenService', () => {
|
||||
const url = TokenService.generateVerificationUrl(baseUrl, token);
|
||||
|
||||
// Assert
|
||||
expect(url).toBe('https://example.com/api/auth/verify-email?token=verification-token-123');
|
||||
expect(url).toBe('https://example.com/verify-email?token=verification-token-123');
|
||||
});
|
||||
|
||||
it('should encode special characters in token', () => {
|
||||
@@ -359,7 +359,7 @@ describe('TokenService', () => {
|
||||
const url = TokenService.generatePasswordResetUrl(baseUrl, token);
|
||||
|
||||
// Assert
|
||||
expect(url).toBe('https://example.com/api/auth/reset-password?token=reset-token-456');
|
||||
expect(url).toBe('https://example.com/reset-password?token=reset-token-456');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@ export const createMockUser = (overrides: Partial<UserAggregate> = {}): UserAggr
|
||||
orgid: null,
|
||||
token: null,
|
||||
TokenExpires: null,
|
||||
type: 'regular',
|
||||
phone: null,
|
||||
state: UserState.REGISTERED_NOT_VERIFIED,
|
||||
regdate: new Date('2025-01-01'),
|
||||
updatedate: new Date('2025-01-01'),
|
||||
updateDate: new Date('2025-01-01'),
|
||||
Orglogindate: null,
|
||||
get isAdmin() { return this.state === UserState.ADMIN; },
|
||||
...overrides
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ export const createMockOrganization = (overrides: Partial<OrganizationAggregate>
|
||||
contactemail: 'contact@testorg.com',
|
||||
state: OrganizationState.ACTIVE,
|
||||
regdate: new Date('2025-01-01'),
|
||||
updatedate: new Date('2025-01-01'),
|
||||
updateDate: new Date('2025-01-01'),
|
||||
url: null,
|
||||
userinorg: 0,
|
||||
maxOrganizationalDecks: 10,
|
||||
@@ -52,9 +52,11 @@ export const createMockDeck = (overrides: Partial<DeckAggregate> = {}): DeckAggr
|
||||
cards: [],
|
||||
playedNumber: 0,
|
||||
ctype: CType.PUBLIC,
|
||||
updatedate: new Date('2025-01-01'),
|
||||
updateDate: new Date('2025-01-01'),
|
||||
state: DeckState.ACTIVE,
|
||||
organization: null,
|
||||
user: null,
|
||||
isEditable: jest.fn().mockReturnValue(true),
|
||||
...overrides
|
||||
});
|
||||
|
||||
@@ -92,6 +94,7 @@ export const createMockUserRepository = (): jest.Mocked<IUserRepository> => ({
|
||||
delete: jest.fn(),
|
||||
softDelete: jest.fn(),
|
||||
deactivate: jest.fn(),
|
||||
activate: jest.fn(),
|
||||
} as jest.Mocked<IUserRepository>);
|
||||
|
||||
export const createMockOrganizationRepository = (): jest.Mocked<IOrganizationRepository> => ({
|
||||
|
||||
Reference in New Issue
Block a user