Skip to content

Commit

Permalink
Fix dataset tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lyndsiWilliams committed Nov 29, 2022
1 parent 80aa665 commit a42b75f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('AddDataset', () => {
const blankeStateImgs = screen.getAllByRole('img', { name: /empty/i });

// Header
expect(await screen.findByTestId('editable-title')).toBeVisible();
expect(await screen.findByText(/new dataset/i)).toBeVisible();
// Left panel
expect(blankeStateImgs[0]).toBeVisible();
// Footer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,23 @@ describe('Header', () => {
test('renders a blank state Header', async () => {
await waitForRender();

const datasetName = screen.getByTestId('editable-title');
const saveButton = screen.getByRole('button', {
name: /save save/i,
});
const menuButton = screen.getByRole('button', {
name: /menu actions trigger/i,
});
const datasetName = screen.getByText(/new dataset/i);

expect(datasetName).toBeVisible();
expect(saveButton).toBeVisible();
expect(saveButton).toBeDisabled();
expect(menuButton).toBeVisible();
expect(menuButton).toBeDisabled();
});

test('displays "New dataset" when a table is not selected', async () => {
await waitForRender();

const datasetName = screen.getByTestId('editable-title');
const datasetName = screen.getByText(/new dataset/i);
expect(datasetName.innerHTML).toBe(DEFAULT_TITLE);
});

test('displays table name when a table is selected', async () => {
// The schema and table name are passed in through props once selected
await waitForRender({ schema: 'testSchema', title: 'testTable' });

const datasetName = screen.getByTestId('editable-title');
const datasetName = screen.getByText(/testtable/i);

expect(datasetName.innerHTML).toBe('testTable');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('DatasetLayout', () => {
it('renders a Header when passed in', async () => {
await waitForRender();

expect(screen.getByTestId('editable-title')).toBeVisible();
expect(screen.getByText(/new dataset/i)).toBeVisible();
});

it('renders a LeftPanel when passed in', async () => {
Expand Down

0 comments on commit a42b75f

Please sign in to comment.