Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Fix act errors in DndFilterSelect test #21429

Merged
merged 1 commit into from
Sep 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,25 @@ const baseFormData = {
datasource: 'table__1',
};

test('renders with default props', () => {
test('renders with default props', async () => {
render(<DndFilterSelect {...defaultProps} />, { useDnd: true });
expect(screen.getByText('Drop columns or metrics here')).toBeInTheDocument();
expect(
await screen.findByText('Drop columns or metrics here'),
).toBeInTheDocument();
});

test('renders with value', () => {
test('renders with value', async () => {
const value = new AdhocFilter({
sqlExpression: 'COUNT(*)',
expressionType: EXPRESSION_TYPES.SQL,
});
render(<DndFilterSelect {...defaultProps} value={[value]} />, {
useDnd: true,
});
expect(screen.getByText('COUNT(*)')).toBeInTheDocument();
expect(await screen.findByText('COUNT(*)')).toBeInTheDocument();
});

test('renders options with saved metric', () => {
test('renders options with saved metric', async () => {
render(
<DndFilterSelect
{...defaultProps}
Expand All @@ -78,10 +80,12 @@ test('renders options with saved metric', () => {
useDnd: true,
},
);
expect(screen.getByText('Drop columns or metrics here')).toBeInTheDocument();
expect(
await screen.findByText('Drop columns or metrics here'),
).toBeInTheDocument();
});

test('renders options with column', () => {
test('renders options with column', async () => {
render(
<DndFilterSelect
{...defaultProps}
Expand All @@ -98,10 +102,12 @@ test('renders options with column', () => {
useDnd: true,
},
);
expect(screen.getByText('Drop columns or metrics here')).toBeInTheDocument();
expect(
await screen.findByText('Drop columns or metrics here'),
).toBeInTheDocument();
});

test('renders options with adhoc metric', () => {
test('renders options with adhoc metric', async () => {
const adhocMetric = new AdhocMetric({
expression: 'AVG(birth_names.num)',
metric_name: 'avg__num',
Expand All @@ -119,5 +125,7 @@ test('renders options with adhoc metric', () => {
useDnd: true,
},
);
expect(screen.getByText('Drop columns or metrics here')).toBeInTheDocument();
expect(
await screen.findByText('Drop columns or metrics here'),
).toBeInTheDocument();
});