refact: changed get rows to export for tables
This commit is contained in:
parent
6b82a167b6
commit
b78a064f0e
@ -15,7 +15,7 @@ class Table {
|
||||
}
|
||||
}
|
||||
|
||||
getRows = () => this.rows
|
||||
export = () => this.rows
|
||||
|
||||
setRows = rows => {
|
||||
const rowsValidation = this._validateRows(rows)
|
||||
|
@ -20,7 +20,7 @@ class FilterNode extends Node {
|
||||
}
|
||||
|
||||
export = () => {
|
||||
let rows = this.tables.map(t => t.getRows() ).flat()
|
||||
let rows = this.tables.map(t => t.export() ).flat()
|
||||
let filters = this._createFilterMethods()
|
||||
|
||||
filters.forEach(f => {
|
||||
|
@ -8,7 +8,7 @@ class JoinNode extends Node {
|
||||
|
||||
export = () => {
|
||||
const baseTable = this.tables.find(t => t.label === this.baseTableLabel)
|
||||
const baseTableRows = baseTable.getRows()
|
||||
const baseTableRows = baseTable.export()
|
||||
const tablesToJoin = this.tables.filter(t => {
|
||||
return t.label !== this.baseTableLabel
|
||||
})
|
||||
@ -17,7 +17,7 @@ class JoinNode extends Node {
|
||||
const foreignTable = tablesToJoin.find(t => {
|
||||
return t.label === joinParam.foreignTable
|
||||
})
|
||||
const foreignTableRows = foreignTable.getRows()
|
||||
const foreignTableRows = foreignTable.export()
|
||||
|
||||
const mergedRows = baseTableRows.map(baseRow => {
|
||||
const matchingForeignRow = foreignTableRows.find(foreignRow => {
|
||||
|
@ -40,7 +40,7 @@ const getTableRows = () => {
|
||||
|
||||
try {
|
||||
const table = new Table(input)
|
||||
const tableRows = table.getRows()
|
||||
const tableRows = table.export()
|
||||
if (JSON.stringify(tableRows) === JSON.stringify(expectedOutput)) return true
|
||||
else return false
|
||||
} catch (err) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user