Przeglądaj źródła

Merge pull request #21225 from takahirox/BufferAttributeToJSONTest

Tests: Add BufferAttribute.toJSON() unit test
Mr.doob 4 lat temu
rodzic
commit
8b188544ae
1 zmienionych plików z 12 dodań i 0 usunięć
  1. 12 0
      test/unit/src/core/BufferAttribute.tests.js

+ 12 - 0
test/unit/src/core/BufferAttribute.tests.js

@@ -243,6 +243,18 @@ export default QUnit.module( 'Core', () => {
 
 		} );
 
+		QUnit.test( "toJSON", ( assert ) => {
+
+			const attr = new BufferAttribute( new Float32Array( [ 1, 2, 3, 4, 5, 6 ] ), 3, true );
+			assert.deepEqual( attr.toJSON(), {
+				itemSize: 3,
+				type: 'Float32Array',
+				array: [ 1, 2, 3, 4, 5, 6 ],
+				normalized: true
+			}, 'Serialized to JSON as expected' );
+
+		} );
+
 		// OTHERS
 		QUnit.test( "count", ( assert ) => {