Chatwoot/app/javascript/dashboard/api/specs/inbox/message.spec.js

33 lines
972 B
JavaScript
Raw Normal View History

import messageAPI from '../../inbox/message';
import ApiClient from '../../ApiClient';
import describeWithAPIMock from '../apiSpecHelper';
describe('#ConversationAPI', () => {
it('creates correct instance', () => {
expect(messageAPI).toBeInstanceOf(ApiClient);
expect(messageAPI).toHaveProperty('get');
expect(messageAPI).toHaveProperty('show');
expect(messageAPI).toHaveProperty('create');
expect(messageAPI).toHaveProperty('update');
expect(messageAPI).toHaveProperty('delete');
expect(messageAPI).toHaveProperty('getPreviousMessages');
});
describeWithAPIMock('API calls', context => {
it('#getPreviousMessages', () => {
messageAPI.getPreviousMessages({
conversationId: 12,
before: 4573,
});
expect(context.axiosMock.get).toHaveBeenCalledWith(
`/api/v1/conversations/12/messages`,
{
params: {
before: 4573,
},
}
);
});
});
});