website/src/lib/server/minecraft.test.ts
bytedream 9e812fdef2
All checks were successful
delpoy / build-and-deploy (push) Successful in 38s
feat: rename cracked to noauth and remove the possibility to self register as such
2023-11-13 11:42:24 +01:00

28 lines
941 B
TypeScript

import { describe, expect, test } from 'vitest';
import { getBedrockUuid, getJavaUuid, getNoAuthUuid } from '$lib/server/minecraft';
describe('java username', () => {
test('is valid', async () => {
expect(getJavaUuid('bytedream')).resolves.toBe('9aa026cc-b5dc-4357-a319-ab668101af0d');
});
test('is invalid', async () => {
expect(getJavaUuid('57eoTQaLYchmETrTsWnNZXtZh')).rejects.toThrowError();
});
});
describe('bedrock username', () => {
test('is valid', async () => {
expect(getBedrockUuid('bytedream')).resolves.toBe('00000000-0000-0000-0009-01F5BF975D37');
});
test('is invalid', async () => {
expect(getBedrockUuid('57eoTQaLYchmETrTsWnNZXtZh')).rejects.toThrowError();
});
});
describe('noauth username', () => {
// every username can be converted to an uuid so every user id automatically valid
test('is valid', () => {
expect(getNoAuthUuid('bytedream')).toBe('88de3863-bf47-30f9-a7f4-ab6134feb49a');
});
});