getmodulepath.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. const modules = bender.amd.require( 'ckeditor5/path' );
  7. let path;
  8. before( () => {
  9. path = modules[ 'ckeditor5/path' ];
  10. } );
  11. describe( 'getModulePath()', () => {
  12. it( 'generates path for the main file', () => {
  13. const p = path.getModulePath( 'ckeditor' );
  14. expect( p ).to.equal( 'ckeditor.js' );
  15. } );
  16. it( 'generates path for modules within ckeditor5 package', () => {
  17. const p = path.getModulePath( 'ckeditor5/foo' );
  18. expect( p ).to.equal( 'ckeditor5/foo.js' );
  19. } );
  20. it( 'generates path for modules within the core package', () => {
  21. const p = path.getModulePath( 'core/ui/controller' );
  22. expect( p ).to.equal( 'ckeditor5-core/ui/controller.js' );
  23. } );
  24. it( 'generates path for modules within some package', () => {
  25. const p = path.getModulePath( 'some/ba' );
  26. expect( p ).to.equal( 'ckeditor5-some/ba.js' );
  27. } );
  28. it( 'generates path from simplified feature name', () => {
  29. const p = path.getModulePath( 'foo' );
  30. expect( p ).to.equal( 'ckeditor5-foo/foo.js' );
  31. } );
  32. } );