14 lines
493 B
TypeScript
14 lines
493 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { exportCharacterJson, importCharacterFromText } from '$lib/storage/io';
|
|
import { newCharacter } from '$lib/characters/default';
|
|
|
|
describe('io', () => {
|
|
it('roundtrips JSON', () => {
|
|
const c = newCharacter({ name: 'IO', id: '00000000-0000-4000-8000-0000000000aa' });
|
|
const json = exportCharacterJson(c);
|
|
const back = importCharacterFromText(json, 'json');
|
|
expect(back.meta.name).toBe('IO');
|
|
expect(back.id).toBe(c.id);
|
|
});
|
|
});
|