Add backend feedback submission and image preview
Some checks failed
CI / verify (push) Has been cancelled
Some checks failed
CI / verify (push) Has been cancelled
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
listRpgProfileBrowseHistory,
|
||||
listRpgProfileSaveArchives,
|
||||
resumeRpgProfileSaveArchive,
|
||||
submitRpgProfileFeedback,
|
||||
syncRpgProfileBrowseHistory,
|
||||
upsertRpgProfileBrowseHistory,
|
||||
} from './rpgProfileClient';
|
||||
@@ -156,3 +157,59 @@ describe('rpgProfileClient save archive routes', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('rpgProfileClient feedback routes', () => {
|
||||
beforeEach(() => {
|
||||
requestJsonMock.mockReset();
|
||||
requestJsonMock.mockResolvedValue({
|
||||
feedback: {
|
||||
feedbackId: 'feedback:user-1:1',
|
||||
status: 'open',
|
||||
createdAt: '2026-05-08T10:00:00Z',
|
||||
evidenceItems: [],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('submits profile feedback through the profile route', async () => {
|
||||
await submitRpgProfileFeedback({
|
||||
description: '图片上传后没有展示预览',
|
||||
contactPhone: null,
|
||||
evidenceItems: [
|
||||
{
|
||||
fileName: 'preview.png',
|
||||
contentType: 'image/png',
|
||||
sizeBytes: 128,
|
||||
dataUrl: 'data:image/png;base64,ZmVlZGJhY2s=',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(requestJsonMock).toHaveBeenCalledWith(
|
||||
'/api/profile/feedback',
|
||||
expect.objectContaining({
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
}),
|
||||
'提交反馈失败',
|
||||
expect.objectContaining({
|
||||
retry: expect.objectContaining({
|
||||
maxRetries: 1,
|
||||
retryUnsafeMethods: true,
|
||||
}),
|
||||
}),
|
||||
);
|
||||
expect(JSON.parse(requestJsonMock.mock.calls[0][1].body)).toEqual({
|
||||
description: '图片上传后没有展示预览',
|
||||
contactPhone: null,
|
||||
evidenceItems: [
|
||||
{
|
||||
fileName: 'preview.png',
|
||||
contentType: 'image/png',
|
||||
sizeBytes: 128,
|
||||
dataUrl: 'data:image/png;base64,ZmVlZGJhY2s=',
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user