odfjs/tests/create-ods-file.js
David Bruant a3a2393217
Zipjs (#7)
* Remplacement de unzipit par zip.js

* Générer un fichier qui est valide et s'ouvre dans LibreOffice

* blip bloop, smaller browser bundle

* uninstall xlsx
2025-03-25 22:06:53 +01:00

38 lines
885 B
JavaScript

import test from 'ava';
import {getODSTableRawContent, createOdsFile} from '../scripts/node.js'
/** @import {SheetName, SheetRawContent} from '../scripts/types.js' */
test('basic file creation', async t => {
/** @type {Map<SheetName, SheetRawContent>} */
const content = new Map([
[
'La feuille',
[
[
{value: 'azerty', type: 'string'},
{value: '37', type: 'float'}
]
]
]
])
const odsFile = await createOdsFile(content)
const parsedContent = await getODSTableRawContent(odsFile)
t.assert(parsedContent.has('La feuille'))
const feuille = parsedContent.get('La feuille')
t.deepEqual(feuille, [
[
{value: 'azerty', type: 'string'},
{value: '37', type: 'float'}
]
])
});