Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabryje committed Jul 23, 2021
1 parent 04f6396 commit 3ce834a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Expand Up @@ -73,7 +73,7 @@ test('Rendering DataTablesPane correctly', () => {
expect(screen.getByRole('img', { name: 'right' })).toBeVisible();
});

test('Shoud show tabs', async () => {
test('Should show tabs', async () => {
const props = createProps();
render(<DataTablesPane {...props} />, { useRedux: true });
expect(screen.queryByText('View results')).not.toBeInTheDocument();
Expand All @@ -83,7 +83,7 @@ test('Shoud show tabs', async () => {
expect(screen.getByText('View samples')).toBeVisible();
});

test('Shoud show tabs: View results', async () => {
test('Should show tabs: View results', async () => {
const props = createProps();
render(<DataTablesPane {...props} />, {
useRedux: true,
Expand All @@ -93,7 +93,7 @@ test('Shoud show tabs: View results', async () => {
expect(screen.getByText('0 rows retrieved')).toBeVisible();
});

test('Shoud show tabs: View samples', async () => {
test('Should show tabs: View samples', async () => {
const props = createProps();
render(<DataTablesPane {...props} />, {
useRedux: true,
Expand Down
Expand Up @@ -155,11 +155,10 @@ export const DataTablesPane = ({
})
.then(({ json }) => {
// Only displaying the first query is currently supported
const result = ensureIsArray(json.result);
if (result.length > 1) {
if (json.result.length > 1) {
const data: any[] = [];
result.forEach(item => {
ensureIsArray(item.data).forEach((row, i) => {
json.result.forEach((item: { data: any[] }) => {
item.data.forEach((row, i) => {
if (data[i] !== undefined) {
data[i] = { ...data[i], ...row };
} else {
Expand All @@ -174,7 +173,7 @@ export const DataTablesPane = ({
} else {
setData(prevData => ({
...prevData,
[resultType]: result[0].data,
[resultType]: json.result[0].data,
}));
}

Expand Down

0 comments on commit 3ce834a

Please sign in to comment.