1- import test from 'tape ' ;
1+ import { it , expect } from 'vitest ' ;
22import vtkCellArray from 'vtk.js/Sources/Common/Core/CellArray' ;
33import vtkDataArray from 'vtk.js/Sources/Common/Core/DataArray' ;
44import vtkPoints from 'vtk.js/Sources/Common/Core/Points' ;
@@ -31,7 +31,7 @@ function createSquareAsTriangles() {
3131 return polydata ;
3232}
3333
34- test ( 'vtkClipPolyData clips a triangle mesh and produces clipped output' , ( t ) => {
34+ it ( 'vtkClipPolyData clips a triangle mesh and produces clipped output' , ( ) => {
3535 const plane = vtkPlane . newInstance ( {
3636 origin : [ 0 , 0 , 0 ] ,
3737 normal : [ 1 , 0 , 0 ] ,
@@ -48,25 +48,28 @@ test('vtkClipPolyData clips a triangle mesh and produces clipped output', (t) =>
4848 const kept = clipper . getOutputData ( ) ;
4949 const clipped = clipper . getOutputData ( 1 ) ;
5050
51- t . equal ( kept . getNumberOfPolys ( ) , 3 , 'kept side is triangulated into 3 polys' ) ;
52- t . equal (
51+ expect (
52+ kept . getNumberOfPolys ( ) ,
53+ 'kept side is triangulated into 3 polys'
54+ ) . toBe ( 3 ) ;
55+ expect (
5356 clipped . getNumberOfPolys ( ) ,
5457 3 ,
5558 'clipped side is triangulated into 3 polys'
56- ) ;
57- t . equal (
59+ ) . toBe ( 3 ) ;
60+ expect (
5861 kept . getNumberOfPoints ( ) ,
5962 7 ,
6063 'shared point set contains originals and intersections'
64+ ) . toBe ( 7 ) ;
65+ expect ( clipped . getNumberOfPoints ( ) , 'clipped output shares point set' ) . toBe (
66+ 7
6167 ) ;
62- t . equal ( clipped . getNumberOfPoints ( ) , 7 , 'clipped output shares point set' ) ;
6368
6469 const keptScalars = kept . getPointData ( ) . getScalars ( ) . getData ( ) ;
65- t . equal ( keptScalars . length , 7 , 'generated clip scalars were attached' ) ;
66- t . ok (
70+ expect ( keptScalars . length , 'generated clip scalars were attached' ) . toBe ( 7 ) ;
71+ expect (
6772 Array . from ( keptScalars ) . includes ( 0 ) ,
6873 'intersection points carry the clip value'
69- ) ;
70-
71- t . end ( ) ;
74+ ) . toBeTruthy ( ) ;
7275} ) ;
0 commit comments