Initial commit: Add logistics and order_detail message types
Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
- Add Logistics component with progress tracking - Add OrderDetail component for order information - Support data-driven steps and actions - Add blue color scale to widget SCSS - Fix node overflow and progress bar rendering issues - Add English translations for dashboard components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
import axios from 'axios';
|
||||
import { actions } from '../../contactNotes';
|
||||
import * as types from '../../../mutation-types';
|
||||
import notesData from './fixtures';
|
||||
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
it('sends correct actions if API is success', async () => {
|
||||
axios.get.mockResolvedValue({ data: notesData });
|
||||
await actions.get({ commit }, { contactId: 23 });
|
||||
expect(commit.mock.calls).toEqual([
|
||||
[types.default.SET_CONTACT_NOTES_UI_FLAG, { isFetching: true }],
|
||||
[types.default.SET_CONTACT_NOTES, { contactId: 23, data: notesData }],
|
||||
[types.default.SET_CONTACT_NOTES_UI_FLAG, { isFetching: false }],
|
||||
]);
|
||||
});
|
||||
it('sends correct actions if API is error', async () => {
|
||||
axios.get.mockRejectedValue({ message: 'Incorrect header' });
|
||||
await expect(actions.get({ commit }, { contactId: 23 })).rejects.toThrow(
|
||||
Error
|
||||
);
|
||||
expect(commit.mock.calls).toEqual([
|
||||
[types.default.SET_CONTACT_NOTES_UI_FLAG, { isFetching: true }],
|
||||
[types.default.SET_CONTACT_NOTES_UI_FLAG, { isFetching: false }],
|
||||
]);
|
||||
});
|
||||
});
|
||||
describe('#create', () => {
|
||||
it('sends correct actions if API is success', async () => {
|
||||
axios.post.mockResolvedValue({ data: { id: 2, content: 'hi' } });
|
||||
await actions.create({ commit }, { contactId: 1, content: 'hi' });
|
||||
expect(commit.mock.calls).toEqual([
|
||||
[types.default.SET_CONTACT_NOTES_UI_FLAG, { isCreating: true }],
|
||||
[
|
||||
types.default.ADD_CONTACT_NOTE,
|
||||
{ contactId: 1, data: { id: 2, content: 'hi' } },
|
||||
],
|
||||
[types.default.SET_CONTACT_NOTES_UI_FLAG, { isCreating: false }],
|
||||
]);
|
||||
});
|
||||
it('sends correct actions if API is error', async () => {
|
||||
axios.post.mockRejectedValue({ message: 'Incorrect header' });
|
||||
await expect(
|
||||
actions.create({ commit }, { contactId: 1, content: 'hi' })
|
||||
).rejects.toThrow(Error);
|
||||
expect(commit.mock.calls).toEqual([
|
||||
[types.default.SET_CONTACT_NOTES_UI_FLAG, { isCreating: true }],
|
||||
[types.default.SET_CONTACT_NOTES_UI_FLAG, { isCreating: false }],
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#delete', () => {
|
||||
it('sends correct actions if API is success', async () => {
|
||||
axios.delete.mockResolvedValue({ data: notesData[0] });
|
||||
await actions.delete({ commit }, { contactId: 1, noteId: 2 });
|
||||
expect(commit.mock.calls).toEqual([
|
||||
[types.default.SET_CONTACT_NOTES_UI_FLAG, { isDeleting: true }],
|
||||
[types.default.DELETE_CONTACT_NOTE, { contactId: 1, noteId: 2 }],
|
||||
[types.default.SET_CONTACT_NOTES_UI_FLAG, { isDeleting: false }],
|
||||
]);
|
||||
});
|
||||
it('sends correct actions if API is error', async () => {
|
||||
axios.delete.mockRejectedValue({ message: 'Incorrect header' });
|
||||
await expect(
|
||||
actions.delete({ commit }, { contactId: 1, noteId: 2 })
|
||||
).rejects.toThrow(Error);
|
||||
expect(commit.mock.calls).toEqual([
|
||||
[types.default.SET_CONTACT_NOTES_UI_FLAG, { isDeleting: true }],
|
||||
[types.default.SET_CONTACT_NOTES_UI_FLAG, { isDeleting: false }],
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
export default [
|
||||
{
|
||||
id: 12345,
|
||||
content: 'It is a long established fact that a reader will be distracted.',
|
||||
user: {
|
||||
name: 'John Doe',
|
||||
thumbnail: 'https://randomuser.me/api/portraits/men/69.jpg',
|
||||
},
|
||||
created_at: 1618046084,
|
||||
},
|
||||
{
|
||||
id: 12346,
|
||||
content:
|
||||
'It is simply dummy text of the printing and typesetting industry.',
|
||||
user: {
|
||||
name: 'Pearl Cruz',
|
||||
thumbnail: 'https://randomuser.me/api/portraits/women/29.jpg',
|
||||
},
|
||||
created_at: 1616046076,
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,24 @@
|
||||
import { getters } from '../../contactNotes';
|
||||
import notesData from './fixtures';
|
||||
|
||||
describe('#getters', () => {
|
||||
it('getAllNotesByContact', () => {
|
||||
const state = { records: { 1: notesData } };
|
||||
expect(getters.getAllNotesByContact(state)(1)).toEqual(notesData);
|
||||
});
|
||||
|
||||
it('getUIFlags', () => {
|
||||
const state = {
|
||||
uiFlags: {
|
||||
isFetching: true,
|
||||
isCreating: false,
|
||||
isDeleting: false,
|
||||
},
|
||||
};
|
||||
expect(getters.getUIFlags(state)).toEqual({
|
||||
isFetching: true,
|
||||
isCreating: false,
|
||||
isDeleting: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
import types from '../../../mutation-types';
|
||||
import { mutations } from '../../contactNotes';
|
||||
import allNotes from './fixtures';
|
||||
|
||||
describe('#mutations', () => {
|
||||
describe('#SET_CONTACT_NOTES', () => {
|
||||
it('set allNotes records', () => {
|
||||
const state = { records: {} };
|
||||
mutations[types.SET_CONTACT_NOTES](state, {
|
||||
data: allNotes,
|
||||
contactId: 1,
|
||||
});
|
||||
expect(state.records).toEqual({ 1: allNotes });
|
||||
});
|
||||
});
|
||||
|
||||
describe('#ADD_CONTACT_NOTE', () => {
|
||||
it('push newly created note to the store', () => {
|
||||
const state = { records: { 1: [allNotes[0]] } };
|
||||
mutations[types.ADD_CONTACT_NOTE](state, {
|
||||
data: allNotes[1],
|
||||
contactId: 1,
|
||||
});
|
||||
expect(state.records[1]).toEqual([allNotes[0], allNotes[1]]);
|
||||
});
|
||||
});
|
||||
describe('#DELETE_CONTACT_NOTE', () => {
|
||||
it('Delete existing note from records', () => {
|
||||
const state = { records: { 1: [{ id: 2 }] } };
|
||||
mutations[types.DELETE_CONTACT_NOTE](state, {
|
||||
noteId: 2,
|
||||
contactId: 1,
|
||||
});
|
||||
expect(state.records[1]).toEqual([]);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user