1
0
Fork 0
mirror of synced 2024-07-02 13:01:09 +12:00

Fixing test case (didn't provide a schema).

This commit is contained in:
Michael Drury 2021-11-12 20:23:00 +00:00
parent 0cf612029e
commit 8ad44e59af
2 changed files with 8 additions and 1 deletions

View file

@ -75,7 +75,11 @@ describe("run misc tests", () => {
}, },
}) })
const dataImport = { const dataImport = {
csvString: "a,b,c,d\n1,2,3,4" csvString: "a,b,c,d\n1,2,3,4",
schema: {},
}
for (let col of ["a", "b", "c", "d"]) {
dataImport.schema[col] = { type: "string" }
} }
await tableUtils.handleDataImport( await tableUtils.handleDataImport(
config.getAppId(), config.getAppId(),

View file

@ -77,6 +77,9 @@ function parse(csvString, parsers) {
} }
function updateSchema({ schema, existingTable }) { function updateSchema({ schema, existingTable }) {
if (!schema) {
return schema
}
const finalSchema = {} const finalSchema = {}
const schemaKeyMap = {} const schemaKeyMap = {}
Object.keys(schema).forEach(key => (schemaKeyMap[key.toLowerCase()] = key)) Object.keys(schema).forEach(key => (schemaKeyMap[key.toLowerCase()] = key))