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 | 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 { PortalCode } from './portalCode'; describe('Portal Coordinate Converter', () => { describe('toGalacticCoordinates', () => { test('with valid coordinate', () => { const result = PortalCode({ code: '023456123456' }).toGalacticCoordinates(); expect(result.isSuccess, result.errorMessage).toBeTruthy(); expect(result.value.code).toBe('0C55:00D5:0922:0234'); }); test('with valid coordinate and last expected digit being a character', () => { const result = PortalCode({ code: '405EA21107FF' }).toGalacticCoordinates(); expect(result.isSuccess, result.errorMessage).toBeTruthy(); expect(result.value.code).toBe('0FFE:0021:090F:005E'); }); test('with invalid coordinate', () => { const result = PortalCode({ code: '0000023456123456' }).toGalacticCoordinates(); expect(result.isSuccess, result.errorMessage).toBeFalsy(); }); test('documentation test', () => { const result = PortalCode({ code: '023456123456' }).toGalacticCoordinates(); expect(result.isSuccess, result.errorMessage).toBeTruthy(); expect(result.value.code).toBe('0C55:00D5:0922:0234'); }); }); describe('toVoxel', () => { test('with valid coordinate', () => { const result = PortalCode({ code: '023456123456' }).toVoxel(); expect(result.isSuccess, result.errorMessage).toBeTruthy(); expect(result.value.VoxelX).toBe(1110); expect(result.value.VoxelY).toBe(86); expect(result.value.VoxelZ).toBe(291); }); test('with invalid coordinate', () => { const result = PortalCode({ code: '0000023456123456' }).toVoxel(); expect(result.isSuccess, result.errorMessage).toBeFalsy(); }); }); }); |