/ tests / point.test.ts
point.test.ts
 1  import { expect, test } from 'vitest'
 2  
 3  import { Point } from '../src/Point'
 4  
 5  test('Clone point', () => {
 6    const point = new Point(2, 2)
 7  
 8    const clonedPoint = point.clone()
 9  
10    point.x = 4
11    point.y = 8
12  
13    expect(clonedPoint).toEqual(new Point(2, 2))
14  })
15  
16  test('Angle between points', () => {
17    const point1 = new Point(2, 2)
18    const point2 = new Point(8, 20)
19  
20    const angleBetween = Point.angleBetween(point1, point2)
21  
22    expect(angleBetween).toEqual(1.2490457723982544)
23  })