mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-07-20 10:41:48 +00:00
Upgrade react-scripts, switch from adm-zip to fflate.
adm-zip did not play nice with compiling to the browser after upgrading react-scripts
This commit is contained in:
23
src/datasource/load_data.spec.ts
Normal file
23
src/datasource/load_data.spec.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import {loadFile} from './load_data';
|
||||
import {readFileSync} from 'fs';
|
||||
import {Blob} from 'buffer';
|
||||
|
||||
describe('loadFile', () => {
|
||||
global.URL.createObjectURL = jest.fn();
|
||||
|
||||
it('loads GEDCOM file', async () => {
|
||||
const file = readFileSync('src/datasource/testdata/test.ged');
|
||||
const blob = new Blob([file]);
|
||||
const {gedcom, images} = await loadFile(blob);
|
||||
expect(gedcom.length).toBe(4408);
|
||||
expect(images).toEqual(new Map());
|
||||
});
|
||||
|
||||
it('loads GEDZIP file', async () => {
|
||||
const file = readFileSync('src/datasource/testdata/test.gdz');
|
||||
const blob = new Blob([file]);
|
||||
const {gedcom, images} = await loadFile(blob);
|
||||
expect(gedcom.length).toBe(4408);
|
||||
expect(images.size).toBe(1);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user