|
1 | | -import test from 'tape'; |
| 1 | +import { it, expect } from 'vitest'; |
2 | 2 | import vtk from 'vtk.js/Sources/vtk'; |
3 | 3 | import vtkDataArray from 'vtk.js/Sources/Common/Core/DataArray'; |
4 | 4 | import { VtkDataTypes } from 'vtk.js/Sources/Common/Core/DataArray/Constants'; |
@@ -554,30 +554,30 @@ it('Test vtkDataArray resize function', () => { |
554 | 554 | ); |
555 | 555 | }); |
556 | 556 |
|
557 | | -test('Test vtkDataArray getState preserveTypedArrays option', (t) => { |
| 557 | +it('Test vtkDataArray getState preserveTypedArrays option', () => { |
558 | 558 | const values = new Uint8Array([1, 2, 3, 4, 5]); |
559 | 559 | const da = vtkDataArray.newInstance({ values }); |
560 | 560 |
|
561 | 561 | // Default: values converted to plain Array |
562 | 562 | const state = da.getState(); |
563 | | - t.ok(Array.isArray(state.values), 'default getState returns plain Array'); |
| 563 | + expect( |
| 564 | + Array.isArray(state.values), |
| 565 | + 'default getState returns plain Array' |
| 566 | + ).toBeTruthy(); |
564 | 567 |
|
565 | 568 | // With option: values preserved as TypedArray |
566 | 569 | const transferable = da.getState({ preserveTypedArrays: true }); |
567 | | - t.ok( |
| 570 | + expect( |
568 | 571 | transferable.values instanceof Uint8Array, |
569 | 572 | 'TypedArray type is preserved' |
570 | | - ); |
| 573 | + ).toBeTruthy(); |
571 | 574 |
|
572 | 575 | // Round-trip via vtk() works with TypedArray values |
573 | 576 | const da2 = vtk(transferable); |
574 | | - t.ok(da2, 'Can reconstruct from state with TypedArray values'); |
575 | | - t.deepEqual( |
| 577 | + expect(da2, 'Can reconstruct from state with TypedArray values').toBeTruthy(); |
| 578 | + expect( |
576 | 579 | Array.from(da2.getData()), |
577 | | - Array.from(values), |
578 | 580 | 'Values preserved after round-trip' |
579 | | - ); |
580 | | - t.equal(da2.getDataType(), 'Uint8Array', 'Data type preserved'); |
581 | | - |
582 | | - t.end(); |
| 581 | + ).toEqual(Array.from(values)); |
| 582 | + expect(da2.getDataType(), 'Data type preserved').toBe('Uint8Array'); |
583 | 583 | }); |
0 commit comments