Skip to content

Commit

Permalink
Test table field encodings
Browse files Browse the repository at this point in the history
  • Loading branch information
JCZuurmond committed Jun 12, 2024
1 parent c762c44 commit f3d8486
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/unit/test_dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Page,
Position,
Query,
TableV2Spec,
Widget,
)

Expand Down Expand Up @@ -184,6 +185,20 @@ def test_dashboards_creates_dashboard_with_expected_counter_field_encoding_names
ws.assert_not_called()


def test_dashboards_creates_dashboard_with_expected_table_field_encodings(tmp_path):
with (tmp_path / "query.sql").open("w") as f:
f.write("SELECT 1 AS first, 2 AS second")

ws = create_autospec(WorkspaceClient)
lakeview_dashboard = Dashboards(ws).create_dashboard(tmp_path)

table_spec = lakeview_dashboard.pages[0].layout[0].widget.spec
assert isinstance(table_spec, TableV2Spec)
assert table_spec.encodings.columns[0].field_name == "first"
assert table_spec.encodings.columns[1].field_name == "second"
ws.assert_not_called()


def test_dashboards_creates_dashboards_with_second_widget_to_the_right_of_the_first_widget(tmp_path):
ws = create_autospec(WorkspaceClient)

Expand Down

0 comments on commit f3d8486

Please sign in to comment.