Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { describe, expect, test } from 'vitest'; import { VoxelInputValidator } from './voxelInputValidation'; import type { VoxelCoordinates } from '@/types/voxelTypes'; import { planetIndexMax, planetIndexMin, solarSystemIndexMax, solarSystemIndexMin, voxelMax, voxelMin, } from '@/constants/restrictions'; describe('Voxel Validation', () => { const baseCoords: VoxelCoordinates = { VoxelX: 1110, VoxelY: 86, VoxelZ: 291, PlanetIndex: 0, SolarSystemIndex: 564, }; test('on null', () => { const coords: any = null; expect(VoxelInputValidator(coords).isValid).toBeFalsy(); }); test('on too small VoxelX coordinate', () => { const coords = { ...baseCoords, VoxelX: voxelMin - 1 }; expect(VoxelInputValidator(coords).isValid).toBeFalsy(); }); test('on too big VoxelX coordinate', () => { const coords = { ...baseCoords, VoxelX: voxelMax + 1 }; expect(VoxelInputValidator(coords).isValid).toBeFalsy(); }); test('on too small VoxelY coordinate', () => { const coords = { ...baseCoords, VoxelY: voxelMin - 1 }; expect(VoxelInputValidator(coords).isValid).toBeFalsy(); }); test('on too big VoxelY coordinate', () => { const coords = { ...baseCoords, VoxelY: voxelMax + 1 }; expect(VoxelInputValidator(coords).isValid).toBeFalsy(); }); test('on too small VoxelZ coordinate', () => { const coords = { ...baseCoords, VoxelZ: voxelMin - 1 }; expect(VoxelInputValidator(coords).isValid).toBeFalsy(); }); test('on too big VoxelZ coordinate', () => { const coords = { ...baseCoords, VoxelZ: voxelMax + 1 }; expect(VoxelInputValidator(coords).isValid).toBeFalsy(); }); test('on too small PlanetIndex coordinate', () => { const coords = { ...baseCoords, PlanetIndex: planetIndexMin - 1 }; expect(VoxelInputValidator(coords).isValid).toBeFalsy(); }); test('on too big PlanetIndex coordinate', () => { const coords = { ...baseCoords, PlanetIndex: planetIndexMax + 1 }; expect(VoxelInputValidator(coords).isValid).toBeFalsy(); }); test('on too small SolarSystemIndex coordinate', () => { const coords = { ...baseCoords, SolarSystemIndex: solarSystemIndexMin - 1 }; expect(VoxelInputValidator(coords).isValid).toBeFalsy(); }); test('on too big SolarSystemIndex coordinate', () => { const coords = { ...baseCoords, SolarSystemIndex: solarSystemIndexMax + 1 }; expect(VoxelInputValidator(coords).isValid).toBeFalsy(); }); }); |