mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-05-26 23:26:15 +00:00
Create gdz file on the fly in test
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import {describe, expect, it} from '@jest/globals';
|
import {describe, expect, it} from '@jest/globals';
|
||||||
import {Blob} from 'buffer';
|
import {Blob, Buffer} from 'buffer';
|
||||||
|
import {zipSync} from 'fflate';
|
||||||
import {readFileSync} from 'fs';
|
import {readFileSync} from 'fs';
|
||||||
import {loadFile} from './load_data';
|
import {loadFile} from './load_data';
|
||||||
|
|
||||||
@@ -17,8 +18,11 @@ describe('loadFile', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('loads GEDZIP file', async () => {
|
it('loads GEDZIP file', async () => {
|
||||||
const file = readFileSync('src/datasource/testdata/test.gdz');
|
const file = zipSync({
|
||||||
const blob = new Blob([file]) as globalThis.Blob;
|
'test.ged': readFileSync('src/datasource/testdata/test.ged'),
|
||||||
|
'topola.jpg': readFileSync('src/datasource/testdata/topola.jpg'),
|
||||||
|
});
|
||||||
|
const blob = new Blob([Buffer.from(file)]) as globalThis.Blob;
|
||||||
const {gedcom, images} = await loadFile(blob);
|
const {gedcom, images} = await loadFile(blob);
|
||||||
expect(gedcom.length).toBe(4408);
|
expect(gedcom.length).toBe(4408);
|
||||||
expect(images.size).toBe(1);
|
expect(images.size).toBe(1);
|
||||||
|
|||||||
BIN
src/datasource/testdata/test.gdz
vendored
BIN
src/datasource/testdata/test.gdz
vendored
Binary file not shown.
BIN
src/datasource/testdata/topola.jpg
vendored
Normal file
BIN
src/datasource/testdata/topola.jpg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
Reference in New Issue
Block a user