Add test
This commit is contained in:
parent
10bb30b344
commit
a2c69626c3
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "front-end-template",
|
||||
"name": "ods-xlsx",
|
||||
"version": "0.6.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "front-end-template",
|
||||
"name": "ods-xlsx",
|
||||
"version": "0.6.0",
|
||||
"dependencies": {
|
||||
"@xmldom/xmldom": "^0.8.10",
|
||||
|
||||
39
tests/sheetRawContentToObjects.js
Normal file
39
tests/sheetRawContentToObjects.js
Normal file
@ -0,0 +1,39 @@
|
||||
import test from 'ava';
|
||||
import { sheetRawContentToObjects } from "../scripts/shared.js"
|
||||
|
||||
test("Empty header value should be kept", t => {
|
||||
const rawContent = [
|
||||
[
|
||||
{
|
||||
type: "string",
|
||||
value: "",
|
||||
},
|
||||
{
|
||||
type: "string",
|
||||
value: "Pitchou",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
type: "string",
|
||||
value: "1",
|
||||
},
|
||||
{
|
||||
type: "string",
|
||||
value: "2",
|
||||
},
|
||||
]
|
||||
]
|
||||
|
||||
const object = sheetRawContentToObjects(rawContent)
|
||||
|
||||
t.deepEqual(
|
||||
object,
|
||||
[
|
||||
{
|
||||
"Column 1": "1",
|
||||
"Pitchou": "2",
|
||||
}
|
||||
]
|
||||
)
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user