@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
19 lines (15 loc) • 493 B
JavaScript
/**
* Internal dependencies
*/
import { cleanForSlug } from '../url';
describe( 'cleanForSlug()', () => {
it( 'Should return string prepared for use as url slug', () => {
expect( cleanForSlug( '/Is th@t Déjà_vu? ' ) ).toBe( 'is-tht-deja_vu' );
} );
it( 'Should return an empty string for missing argument', () => {
expect( cleanForSlug() ).toBe( '' );
} );
it( 'Should return an empty string for falsy argument', () => {
expect( cleanForSlug( null ) ).toBe( '' );
} );
} );