Restructure omni services and add Chatwoot research snapshot

This commit is contained in:
Ruslan Bakiev
2026-02-21 11:11:27 +07:00
parent edea7a0034
commit b73babbbf6
7732 changed files with 978203 additions and 32 deletions

View File

@@ -0,0 +1,54 @@
import fbChannel from '../../channel/fbChannel';
import ApiClient from '../../ApiClient';
describe('#FBChannel', () => {
it('creates correct instance', () => {
expect(fbChannel).toBeInstanceOf(ApiClient);
expect(fbChannel).toHaveProperty('get');
expect(fbChannel).toHaveProperty('show');
expect(fbChannel).toHaveProperty('create');
expect(fbChannel).toHaveProperty('update');
expect(fbChannel).toHaveProperty('delete');
});
describe('API calls', () => {
const originalAxios = window.axios;
const axiosMock = {
post: vi.fn(() => Promise.resolve()),
get: vi.fn(() => Promise.resolve()),
patch: vi.fn(() => Promise.resolve()),
delete: vi.fn(() => Promise.resolve()),
};
beforeEach(() => {
window.axios = axiosMock;
});
afterEach(() => {
window.axios = originalAxios;
});
it('#create', () => {
fbChannel.create({ omniauthToken: 'ASFM131CSF@#@$', appId: 'chatwoot' });
expect(axiosMock.post).toHaveBeenCalledWith(
'/api/v1/callbacks/register_facebook_page',
{
omniauthToken: 'ASFM131CSF@#@$',
appId: 'chatwoot',
}
);
});
it('#reauthorize', () => {
fbChannel.reauthorizeFacebookPage({
omniauthToken: 'ASFM131CSF@#@$',
inboxId: 1,
});
expect(axiosMock.post).toHaveBeenCalledWith(
'/api/v1/callbacks/reauthorize_page',
{
omniauth_token: 'ASFM131CSF@#@$',
inbox_id: 1,
}
);
});
});
});

View File

@@ -0,0 +1,13 @@
import twilioChannel from '../../channel/twilioChannel';
import ApiClient from '../../ApiClient';
describe('#twilioChannel', () => {
it('creates correct instance', () => {
expect(twilioChannel).toBeInstanceOf(ApiClient);
expect(twilioChannel).toHaveProperty('get');
expect(twilioChannel).toHaveProperty('show');
expect(twilioChannel).toHaveProperty('create');
expect(twilioChannel).toHaveProperty('update');
expect(twilioChannel).toHaveProperty('delete');
});
});

View File

@@ -0,0 +1,14 @@
import twitterClient from '../../channel/twitterClient';
import ApiClient from '../../ApiClient';
describe('#TwitterClient', () => {
it('creates correct instance', () => {
expect(twitterClient).toBeInstanceOf(ApiClient);
expect(twitterClient).toHaveProperty('get');
expect(twitterClient).toHaveProperty('show');
expect(twitterClient).toHaveProperty('create');
expect(twitterClient).toHaveProperty('update');
expect(twitterClient).toHaveProperty('delete');
expect(twitterClient).toHaveProperty('generateAuthorization');
});
});

View File

@@ -0,0 +1,13 @@
import webChannelClient from '../../channel/webChannel';
import ApiClient from '../../ApiClient';
describe('#webChannelClient', () => {
it('creates correct instance', () => {
expect(webChannelClient).toBeInstanceOf(ApiClient);
expect(webChannelClient).toHaveProperty('get');
expect(webChannelClient).toHaveProperty('show');
expect(webChannelClient).toHaveProperty('create');
expect(webChannelClient).toHaveProperty('update');
expect(webChannelClient).toHaveProperty('delete');
});
});