File size: 997 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 |
import { whoisType } from '../constants';
import { findRegistrantWhois, findPrivacyServiceWhois } from '../utils';
describe( 'utils', () => {
const whoisData = [
{
org: 'The best company',
type: whoisType.REGISTRANT,
},
{
org: 'Privacy R US',
type: whoisType.PRIVACY_SERVICE,
},
];
describe( 'findRegistrantWhois', () => {
test( 'should return undefined when not registrant object found', () => {
expect( findRegistrantWhois( [] ) ).toBeUndefined();
} );
test( 'should return registrant object from Whois data', () => {
expect( findRegistrantWhois( whoisData ) ).toEqual( whoisData[ 0 ] );
} );
} );
describe( 'findPrivacyServiceWhois', () => {
test( 'should return undefined when not registrant object found', () => {
expect( findPrivacyServiceWhois( [] ) ).toBeUndefined();
} );
test( 'should return privacy service object from Whois data', () => {
expect( findPrivacyServiceWhois( whoisData ) ).toEqual( whoisData[ 1 ] );
} );
} );
} );
|