2021-05-25 08:30:21 +00:00
|
|
|
import inboxesAPI from '../inboxes';
|
2019-12-28 16:26:42 +00:00
|
|
|
import ApiClient from '../ApiClient';
|
2021-05-25 08:30:21 +00:00
|
|
|
import describeWithAPIMock from './apiSpecHelper';
|
2019-12-28 16:26:42 +00:00
|
|
|
|
2020-06-09 10:56:33 +00:00
|
|
|
describe('#InboxesAPI', () => {
|
2019-12-28 16:26:42 +00:00
|
|
|
it('creates correct instance', () => {
|
2021-05-25 08:30:21 +00:00
|
|
|
expect(inboxesAPI).toBeInstanceOf(ApiClient);
|
|
|
|
expect(inboxesAPI).toHaveProperty('get');
|
|
|
|
expect(inboxesAPI).toHaveProperty('show');
|
|
|
|
expect(inboxesAPI).toHaveProperty('create');
|
|
|
|
expect(inboxesAPI).toHaveProperty('update');
|
|
|
|
expect(inboxesAPI).toHaveProperty('delete');
|
|
|
|
expect(inboxesAPI).toHaveProperty('getCampaigns');
|
|
|
|
});
|
|
|
|
describeWithAPIMock('API calls', context => {
|
|
|
|
it('#getCampaigns', () => {
|
|
|
|
inboxesAPI.getCampaigns(2);
|
|
|
|
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
|
|
|
'/api/v1/inboxes/2/campaigns'
|
|
|
|
);
|
|
|
|
});
|
2021-08-31 09:42:05 +00:00
|
|
|
|
|
|
|
it('#deleteInboxAvatar', () => {
|
|
|
|
inboxesAPI.deleteInboxAvatar(2);
|
|
|
|
expect(context.axiosMock.delete).toHaveBeenCalledWith(
|
|
|
|
'/api/v1/inboxes/2/avatar'
|
|
|
|
);
|
|
|
|
});
|
2019-12-28 16:26:42 +00:00
|
|
|
});
|
|
|
|
});
|