Server IP : 172.67.158.161 / Your IP : 3.145.37.251 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/giankuin/thietke365.net/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/settings/shared/test/ |
Upload File : |
/** * External dependencies */ import { isBoolean, isString } from '@woocommerce/types'; /** * Internal dependencies */ import { ADMIN_URL } from '../default-constants'; import { getSettingWithCoercion } from '..'; describe( 'getSettingWithCoercion', () => { it( 'returns provided default for non available setting', () => { expect( getSettingWithCoercion( 'nada', 'really nada', isString ) ).toBe( 'really nada' ); } ); it( 'returns provided default value when the typeguard returns false', () => { expect( getSettingWithCoercion( 'currentUserIsAdmin', '', isString ) ).toBe( '' ); } ); it( 'returns expected value for existing setting', () => { expect( getSettingWithCoercion( 'adminUrl', 'not this', isString ) ).toEqual( ADMIN_URL ); } ); it( "returns expected value for existing setting even if it's a falsy value", () => { expect( getSettingWithCoercion( 'currentUserIsAdmin', true, isBoolean ) ).toBe( false ); } ); } );