Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app/features/article/services/articles.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ describe('ArticlesService', () => {
);
});

expect(req.request.method).toBe('GET');
req.flush({ articles: mockArticleList, articlesCount: 100 });
});

Expand Down
3 changes: 3 additions & 0 deletions src/app/features/article/services/comments.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ describe('CommentsService', () => {
const slug = 'article-with-special-chars-123';
service.getAll(slug).subscribe();
const req = httpMock.expectOne(`/articles/${slug}/comments`);
expect(req.request.method).toBe('GET');
req.flush({ comments: mockComments });
});

Expand Down Expand Up @@ -309,6 +310,7 @@ describe('CommentsService', () => {
const commentId = '456';
service.delete(commentId, slug).subscribe();
const req = httpMock.expectOne(`/articles/${slug}/comments/${commentId}`);
expect(req.request.method).toBe('DELETE');
req.flush(null);
});

Expand All @@ -317,6 +319,7 @@ describe('CommentsService', () => {
const commentId = '550e8400-e29b-41d4-a716-446655440000';
service.delete(commentId, slug).subscribe();
const req = httpMock.expectOne(`/articles/${slug}/comments/${commentId}`);
expect(req.request.method).toBe('DELETE');
req.flush(null);
});
});
Expand Down
5 changes: 5 additions & 0 deletions src/app/features/profile/services/profile.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ describe('ProfileService', () => {
const username = 'user-name_123';
service.get(username).subscribe();
const req = httpMock.expectOne(`/profiles/${username}`);
expect(req.request.method).toBe('GET');
req.flush({ profile: { ...mockProfile, username } });
});

Expand Down Expand Up @@ -315,27 +316,31 @@ describe('ProfileService', () => {
const username = 'user123';
service.get(username).subscribe();
const req = httpMock.expectOne(`/profiles/${username}`);
expect(req.request.method).toBe('GET');
req.flush({ profile: { ...mockProfile, username } });
});

it('should handle username with hyphens', () => {
const username = 'user-name';
service.get(username).subscribe();
const req = httpMock.expectOne(`/profiles/${username}`);
expect(req.request.method).toBe('GET');
req.flush({ profile: { ...mockProfile, username } });
});

it('should handle username with underscores', () => {
const username = 'user_name';
service.get(username).subscribe();
const req = httpMock.expectOne(`/profiles/${username}`);
expect(req.request.method).toBe('GET');
req.flush({ profile: { ...mockProfile, username } });
});

it('should handle very long username', () => {
const username = 'a'.repeat(50);
service.get(username).subscribe();
const req = httpMock.expectOne(`/profiles/${username}`);
expect(req.request.method).toBe('GET');
req.flush({ profile: { ...mockProfile, username } });
});

Expand Down
Loading