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