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 | 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 { handleGlyphCode } from './handleGlyphInput';
describe('Glyph Input handler', () => {
test('valid portal code is returned', () => {
const portalCode = '123456789012';
const result = handleGlyphCode({
code: portalCode,
});
expect(result).toBe(portalCode);
});
test('valid portal code with uppercase to lower', () => {
const portalCode = '123abc789012';
const result = handleGlyphCode({
code: portalCode.toUpperCase(),
});
expect(result).toBe(portalCode);
});
test('valid portal hexArray returns portal code', () => {
const portalCode = '123abc789012';
const result = handleGlyphCode({
hexArray: portalCode.split(''),
});
expect(result).toBe(portalCode);
});
test('valid portal number array returns portal code', () => {
const numberArray = [1, 2, 3, 11, 12, 13, 7, 8, 9, 0, 1, 2];
const portalCode = numberArray
.map((na) => na.toString(16))
.join('')
.toLocaleLowerCase();
const result = handleGlyphCode({
numberArray,
});
expect(result).toBe(portalCode);
});
});
|