2024-10-23 19:13:29 +02:00
|
|
|
import test from 'ava';
|
|
|
|
|
|
2025-04-17 17:39:08 +02:00
|
|
|
import {getODSTableRawContent, createOdsFile} from '../exports.js'
|
2024-10-23 19:13:29 +02:00
|
|
|
|
2025-03-25 22:06:53 +01:00
|
|
|
/** @import {SheetName, SheetRawContent} from '../scripts/types.js' */
|
|
|
|
|
|
2024-10-23 19:13:29 +02:00
|
|
|
test('basic file creation', async t => {
|
2025-03-25 22:06:53 +01:00
|
|
|
/** @type {Map<SheetName, SheetRawContent>} */
|
2024-10-23 19:13:29 +02:00
|
|
|
const content = new Map([
|
|
|
|
|
[
|
|
|
|
|
'La feuille',
|
|
|
|
|
[
|
|
|
|
|
[
|
|
|
|
|
{value: 'azerty', type: 'string'},
|
|
|
|
|
{value: '37', type: 'float'}
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
])
|
|
|
|
|
|
2025-03-25 22:06:53 +01:00
|
|
|
|
2024-10-23 19:13:29 +02:00
|
|
|
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'}
|
|
|
|
|
]
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
});
|