File size: 1,376 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
import { COUNTRIES_SMS_UPDATED, NOTICE_CREATE } from 'calypso/state/action-types';
import { http } from 'calypso/state/data-layer/wpcom-http/actions';
import { fetchCountriesSms, updateCountriesSms, showCountriesSmsLoadingError } from '../';
describe( 'wpcom-api', () => {
describe( 'meta sms-country-codes', () => {
describe( '#fetchCountriesSms', () => {
test( 'should dispatch HTTP request to meta/sms-country-codes', () => {
const action = { type: 'DUMMY' };
expect( fetchCountriesSms( action ) ).toEqual(
expect.objectContaining(
http(
{
apiVersion: '1.1',
method: 'GET',
path: '/meta/sms-country-codes/',
},
action
)
)
);
} );
} );
describe( '#updateCountriesSms', () => {
test( 'should dispatch updated action', () => {
const action = { type: 'DUMMY' };
const data = [ 'BG', 'US', 'UK' ];
expect( updateCountriesSms( action, data ) ).toMatchObject( {
type: COUNTRIES_SMS_UPDATED,
countries: data,
} );
} );
} );
describe( '#showCountriesSmsLoadingError', () => {
test( 'should dispatch error notice', () => {
expect( showCountriesSmsLoadingError() ).toMatchObject( {
type: NOTICE_CREATE,
notice: {
status: 'is-error',
text: "We couldn't load the countries list.",
},
} );
} );
} );
} );
} );
|