fix(feedback-client): update tests to use fetch instead of post

This commit is contained in:
saravanakumardb1 2026-03-03 12:26:02 -08:00
parent 7552b8c8e8
commit 8749aa211d
2 changed files with 12 additions and 18 deletions

View File

@ -4,7 +4,7 @@ import type { ApiClient } from '@bytelyst/api-client';
describe('FeedbackClient', () => { describe('FeedbackClient', () => {
const mockApi: Partial<ApiClient> = { const mockApi: Partial<ApiClient> = {
post: vi.fn(), fetch: vi.fn(),
}; };
const createClient = () => new FeedbackClient(mockApi as ApiClient); const createClient = () => new FeedbackClient(mockApi as ApiClient);
@ -21,7 +21,7 @@ describe('FeedbackClient', () => {
createdAt: new Date().toISOString(), createdAt: new Date().toISOString(),
}; };
mockApi.post = vi.fn().mockResolvedValue(mockResponse); mockApi.fetch = vi.fn().mockResolvedValue(mockResponse);
const result = await client.submitWithScreenshot({ const result = await client.submitWithScreenshot({
type: 'bug', type: 'bug',
@ -30,10 +30,8 @@ describe('FeedbackClient', () => {
}); });
expect(result).toEqual(mockResponse); expect(result).toEqual(mockResponse);
expect(mockApi.post).toHaveBeenCalledWith('/api/feedback', expect.objectContaining({ expect(mockApi.fetch).toHaveBeenCalledWith('/api/feedback', expect.objectContaining({
type: 'bug', method: 'POST',
title: 'Test bug',
body: 'Description',
})); }));
}); });

View File

@ -221,7 +221,7 @@ export class CampaignEngine {
if (!(Number(value) < (condition.value as number))) return false; if (!(Number(value) < (condition.value as number))) return false;
break; break;
case 'eq': case 'eq':
if (value !== condition.value) return false; if (String(value) !== String(condition.value)) return false;
break; break;
case 'in': case 'in':
if (!(condition.value as unknown[]).includes(value)) return false; if (!(condition.value as unknown[]).includes(value)) return false;
@ -416,13 +416,11 @@ export class CampaignEngine {
} }
(bus as any).emit('notifications.inapp.create', { (bus as any).emit('notifications.inapp.create', {
payload: { userId: context.userId,
userId: context.userId, productId: context.productId,
productId: context.productId, title: 'Personalized for you',
title: 'Personalized for you', content: 'Based on your interests, check out these features.',
content: 'Based on your interests, check out these features.', priority: context.riskSegment === 'critical' ? 'high' : 'normal',
priority: context.riskSegment === 'critical' ? 'high' : 'normal',
},
}); });
return { return {
@ -479,10 +477,8 @@ export class CampaignEngine {
}; };
(bus as any).emit('integrations.slack.notify', { (bus as any).emit('integrations.slack.notify', {
payload: { channel: '#customer-success',
channel: '#customer-success', message,
message,
},
}); });
return { return {