LoaderUtils.tests.js 883 B

123456789101112131415161718192021222324252627282930
  1. /* global QUnit */
  2. import { LoaderUtils } from '../../../../src/loaders/LoaderUtils';
  3. export default QUnit.module( 'Loaders', () => {
  4. QUnit.module( 'LoaderUtils', () => {
  5. // INSTANCING
  6. QUnit.test( 'decodeText', ( assert ) => {
  7. var 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. var 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. } );
  18. } );
粤ICP备19079148号