28 lines
941 B
TypeScript
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');
|
|
});
|
|
});
|