feat(channels): add Shangwutong connector

This commit is contained in:
2026-08-03 10:13:40 +08:00
parent 96f5c796a6
commit 897b4e018f
126 changed files with 20207 additions and 272 deletions
@@ -310,11 +310,9 @@ const actions = {
: await MessageApi.create(pendingMessage);
commit(types.ADD_MESSAGE, {
...response.data,
status: MESSAGE_STATUS.SENT,
});
commit(types.ADD_CONVERSATION_ATTACHMENTS, {
...response.data,
status: MESSAGE_STATUS.SENT,
});
} catch (error) {
const errorMessage = error.response
@@ -290,6 +290,39 @@ describe('#actions', () => {
});
});
describe('#sendMessageWithData', () => {
it('keeps the status returned by the server', async () => {
const localCommit = vi.fn();
const pendingMessage = {
id: 'echo-1',
conversation_id: 7,
message: 'hello',
status: 'progress',
content_attributes: {},
};
const responseMessage = {
id: 42,
conversation_id: 7,
content: 'hello',
status: 'progress',
};
axios.mockResolvedValue({ data: responseMessage });
await actions.sendMessageWithData({ commit: localCommit }, pendingMessage);
expect(localCommit).toHaveBeenNthCalledWith(
2,
types.ADD_MESSAGE,
responseMessage
);
expect(localCommit).toHaveBeenNthCalledWith(
3,
types.ADD_CONVERSATION_ATTACHMENTS,
responseMessage
);
});
});
describe('#markMessagesRead', () => {
beforeEach(() => {
vi.useFakeTimers();