mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-12-19 06:58:15 +08:00
merge: Made all tests follow file strcture convention already in-place (#820)
* add empty line to end of file * Move all test files to /test following convention
This commit is contained in:
20
Recursive/test/KochSnowflake.test.js
Normal file
20
Recursive/test/KochSnowflake.test.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import { iterate, Vector2 } from '../KochSnowflake'
|
||||
|
||||
describe('KochSnowflake', () => {
|
||||
it('should produce the correctly-transformed vectors', () => {
|
||||
expect(iterate([new Vector2(0, 0), new Vector2(1, 0)], 1)[0])
|
||||
.toEqual({ x: 0, y: 0 })
|
||||
|
||||
expect(iterate([new Vector2(0, 0), new Vector2(1, 0)], 1)[1])
|
||||
.toEqual({ x: 1 / 3, y: 0 })
|
||||
|
||||
expect(iterate([new Vector2(0, 0), new Vector2(1, 0)], 1)[2])
|
||||
.toEqual({ x: 1 / 2, y: Math.sin(Math.PI / 3) / 3 })
|
||||
|
||||
expect(iterate([new Vector2(0, 0), new Vector2(1, 0)], 1)[3])
|
||||
.toEqual({ x: 2 / 3, y: 0 })
|
||||
|
||||
expect(iterate([new Vector2(0, 0), new Vector2(1, 0)], 1)[4])
|
||||
.toEqual({ x: 1, y: 0 })
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user