Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
fix: sad tests
Browse files Browse the repository at this point in the history
  • Loading branch information
helenosheaa committed Mar 15, 2023
1 parent 339e5f8 commit 77d9314
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/components/BuilderView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ beforeAll(() => {
if (/Warning.*not wrapped in act/.test(args[0])) {
return
}
if (/Each child in a list should have a unique "key" prop/.test(args[0])) {
return
}
originalError.call(console, ...args)
}
})
Expand All @@ -20,7 +23,10 @@ afterAll(() => {
const setup = async (optionOverrides?: object) => {
const props = {
query: '',
datasource: '',
datasource: {
getTables: () => {},
getColumns: () => {}
},
onChange: () => {},
fromRawSql: true,
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/BuilderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ export function BuilderView({query, datasource, onChange, fromRawSql}: any) {
;(async () => {
const res = await datasource.getTables()

const dbSchemaArr = res.frames[0].data.values[1].map((t: string) => ({
const dbSchemaArr = res?.frames[0].data.values[1].map((t: string) => ({
dbSchema: t,
}))

const tableArr = res.frames[0].data.values[2].map((t: string) => ({
const tableArr = res?.frames[0].data.values[2].map((t: string) => ({
label: t,
value: t,
}))

const mergedArr = dbSchemaArr.map((obj: any, index: string | number) => ({
const mergedArr = dbSchemaArr?.map((obj: any, index: string | number) => ({
...obj,
...tableArr[index],
}))
Expand Down
2 changes: 1 addition & 1 deletion src/components/QueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function QueryEditor(props: QueryEditorProps<FlightSQLDataSource, SQLQuer

const getTables = useCallback(async () => {
const res = await datasource.getTables()
return res.frames[0].data.values[2].map((t: string) => ({
return res?.frames[0].data.values[2].map((t: string) => ({
name: checkCasing(t),
}))
}, [datasource])
Expand Down

0 comments on commit 77d9314

Please sign in to comment.