Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ffcc9d65d | ||
| 1285702210 |
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "flyer-crawler",
|
||||
"version": "0.9.74",
|
||||
"version": "0.9.75",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "flyer-crawler",
|
||||
"version": "0.9.74",
|
||||
"version": "0.9.75",
|
||||
"dependencies": {
|
||||
"@bull-board/api": "^6.14.2",
|
||||
"@bull-board/express": "^6.14.2",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "flyer-crawler",
|
||||
"private": true,
|
||||
"version": "0.9.74",
|
||||
"version": "0.9.75",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "concurrently \"npm:start:dev\" \"vite\"",
|
||||
|
||||
@@ -52,9 +52,9 @@ describe('Reaction Routes (/api/reactions)', () => {
|
||||
|
||||
it('should return a list of reactions', async () => {
|
||||
const mockReactions = [
|
||||
{ id: 1, reaction_type: 'like', entity_id: '123' },
|
||||
] as Partial<UserReaction>[];
|
||||
vi.mocked(reactionRepo.getReactions).mockResolvedValue(mockReactions as UserReaction[]);
|
||||
{ reaction_id: 1, reaction_type: 'like', entity_id: '123' },
|
||||
] as unknown as UserReaction[];
|
||||
vi.mocked(reactionRepo.getReactions).mockResolvedValue(mockReactions);
|
||||
|
||||
const response = await supertest(app).get('/api/reactions');
|
||||
|
||||
@@ -64,8 +64,10 @@ describe('Reaction Routes (/api/reactions)', () => {
|
||||
});
|
||||
|
||||
it('should filter by query parameters', async () => {
|
||||
const mockReactions = [{ id: 1, reaction_type: 'like' }] as Partial<UserReaction>[];
|
||||
vi.mocked(reactionRepo.getReactions).mockResolvedValue(mockReactions as UserReaction[]);
|
||||
const mockReactions = [
|
||||
{ reaction_id: 1, reaction_type: 'like' },
|
||||
] as unknown as UserReaction[];
|
||||
vi.mocked(reactionRepo.getReactions).mockResolvedValue(mockReactions);
|
||||
|
||||
const validUuid = '123e4567-e89b-12d3-a456-426614174000';
|
||||
const query = { userId: validUuid, entityType: 'recipe', entityId: '1' };
|
||||
@@ -143,8 +145,12 @@ describe('Reaction Routes (/api/reactions)', () => {
|
||||
};
|
||||
|
||||
it('should return 201 when a reaction is added', async () => {
|
||||
const mockResult = { ...validBody, id: 1, user_id: 'user-123' } as Partial<UserReaction>;
|
||||
vi.mocked(reactionRepo.toggleReaction).mockResolvedValue(mockResult as UserReaction);
|
||||
const mockResult = {
|
||||
...validBody,
|
||||
reaction_id: 1,
|
||||
user_id: 'user-123',
|
||||
} as unknown as UserReaction;
|
||||
vi.mocked(reactionRepo.toggleReaction).mockResolvedValue(mockResult);
|
||||
|
||||
const response = await supertest(app).post('/api/reactions/toggle').send(validBody);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user