LoaderUtils.tests.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* global QUnit */
  2. import { LoaderUtils } from '../../../../src/loaders/LoaderUtils.js';
  3. export default QUnit.module( 'Loaders', () => {
  4. QUnit.module( 'LoaderUtils', () => {
  5. // STATIC
  6. QUnit.test( 'decodeText', ( assert ) => {
  7. const jsonArray = new Uint8Array( [ 123, 34, 106, 115, 111, 110, 34, 58, 32, 116, 114, 117, 101, 125 ] );
  8. assert.equal( '{"json": true}', LoaderUtils.decodeText( jsonArray ) );
  9. const multibyteArray = new Uint8Array( [ 230, 151, 165, 230, 156, 172, 229, 155, 189 ] );
  10. assert.equal( '日本国', LoaderUtils.decodeText( multibyteArray ) );
  11. } );
  12. QUnit.test( 'extractUrlBase', ( assert ) => {
  13. assert.equal( '/path/to/', LoaderUtils.extractUrlBase( '/path/to/model.glb' ) );
  14. assert.equal( './', LoaderUtils.extractUrlBase( 'model.glb' ) );
  15. assert.equal( '/', LoaderUtils.extractUrlBase( '/model.glb' ) );
  16. } );
  17. QUnit.todo( 'resolveURL', ( assert ) => {
  18. // static resolveURL( url, path )
  19. assert.ok( false, 'everything\'s gonna be alright' );
  20. } );
  21. } );
  22. } );