File size: 1,216 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 |
import initialDomainState from '../initial';
import { getDomainWapiInfoByDomainName } from '../selectors';
describe( 'selectors', () => {
describe( 'getDomainWapiInfoByDomainName', () => {
const DOMAIN_NAME = 'dummy.com';
test( 'should return default domain state when state is empty', () => {
expect( getDomainWapiInfoByDomainName( {}, DOMAIN_NAME ) ).toEqual( initialDomainState );
} );
test( 'should return default domain state when fetching state for domain that has no data', () => {
const state = {
domains: {
transfer: {
items: {
'wordpress.com': {
...initialDomainState,
isRequestingTransferCode: true,
},
},
},
},
};
expect( getDomainWapiInfoByDomainName( state, DOMAIN_NAME ) ).toEqual( initialDomainState );
} );
test( 'should return domain data when domain data is known', () => {
const domainState = {
...initialDomainState,
isRequestingTransferCode: true,
};
const state = {
domains: {
transfer: {
items: {
[ DOMAIN_NAME ]: domainState,
},
},
},
};
expect( getDomainWapiInfoByDomainName( state, DOMAIN_NAME ) ).toEqual( domainState );
} );
} );
} );
|