From 07abf7374296f4ab35383a714cedd07de3fdd4b5 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Thu, 23 Jul 2020 16:54:24 +1000 Subject: [PATCH] Remove tests for old loadScript and loadStyle --- .../src/store/test/controls.js | 36 ++++--------------- 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/packages/block-directory/src/store/test/controls.js b/packages/block-directory/src/store/test/controls.js index 174cc5796c33ec..43d4f56ac0fab4 100644 --- a/packages/block-directory/src/store/test/controls.js +++ b/packages/block-directory/src/store/test/controls.js @@ -1,45 +1,21 @@ /** * Internal dependencies */ -import { loadScript, loadStyle } from '../controls'; +import { loadAsset } from '../controls'; describe( 'controls', () => { - const scriptAsset = 'http://www.wordpress.org/plugins/fakeasset.js'; - const styleAsset = 'http://www.wordpress.org/plugins/fakeasset.css'; + describe( 'loadAsset', () => { + const script = document.createElement( 'script' ); + const style = document.createElement( 'link' ); - describe( 'loadScript', () => { it( 'should return a Promise when loading a script', () => { - const result = loadScript( scriptAsset ); + const result = loadAsset( script ); expect( typeof result.then ).toBe( 'function' ); } ); - it( 'should reject when no script is given', async () => { - expect.assertions( 1 ); - const result = loadScript( '' ); - await expect( result ).rejects.toThrow( Error ); - } ); - - it( 'should reject when a non-js file is given', async () => { - const result = loadScript( styleAsset ); - await expect( result ).rejects.toThrow( Error ); - } ); - } ); - - describe( 'loadStyle', () => { it( 'should return a Promise when loading a style', () => { - const result = loadStyle( styleAsset ); + const result = loadAsset( style ); expect( typeof result.then ).toBe( 'function' ); } ); - - it( 'should reject when no style is given', async () => { - expect.assertions( 1 ); - const result = loadStyle( '' ); - await expect( result ).rejects.toThrow( Error ); - } ); - - it( 'should reject when a non-css file is given', async () => { - const result = loadStyle( scriptAsset ); - await expect( result ).rejects.toThrow( Error ); - } ); } ); } );