react-code-dataset / wp-calypso /client /state /data-layer /wpcom /meta /sms-country-codes /test /index.js
react-code-dataset / wp-calypso /client /state /data-layer /wpcom /meta /sms-country-codes /test /index.js
Download wp-calypso/client/state/data-layer/wpcom/meta/sms-country-codes/test/index.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/data-layer/wpcom/meta/sms-country-codes/test/index.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/data-layer/wpcom/meta/sms-country-codes/test/index.js
-
curl -L -o index.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/data-layer/wpcom/meta/sms-country-codes/test/index.js
1.38 kB
| 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.", | |
| }, | |
| } ); | |
| } ); | |
| } ); | |
| } ); | |
| } ); | |