odfjs/tests/create-ods-file.js
David Bruant 5a539f333d
expose odt text function (#1)
* Remove xlsx support

* Restructure exports to avoid duplication of DOM-related code

* browser DOM exports

* Fixing exports field in package.json
2025-04-17 17:39:08 +02:00

38 lines
880 B
JavaScript

import test from 'ava';
import {getODSTableRawContent, createOdsFile} from '../exports.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'}
]
])
});