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

View File

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