Skip to content

Commit

Permalink
More tests and naming adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
cristineguadelupe committed Sep 14, 2023
1 parent 1cbf30c commit cbdcd79
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions test/kino/attribute_store_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ defmodule Kino.AttributeStoreTets do
assert AttributeStore.get_attribute({test, :no_attr}) == nil
end

test "returns a custom default value if the shared attr doesn't exist", %{test: test} do
assert AttributeStore.get_attribute({test, :no_attr}, {nil, nil}) == {nil, nil}
end

test "returns the value if the shared attr exist", %{test: test} do
AttributeStore.put_attribute({test, :shared_attr}, "plain value")
assert AttributeStore.get_attribute({test, :shared_attr}) == "plain value"
Expand Down
8 changes: 4 additions & 4 deletions test/kino/remote_execution_cell_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ defmodule Kino.RemoteExecutionCellTest do
:ok
end

test "from prefilled attrs" do
test "from stored attrs" do
{_kino, source} = start_smart_cell!(RemoteExecutionCell, %{})

assert source == """
Expand All @@ -185,7 +185,7 @@ defmodule Kino.RemoteExecutionCellTest do
"""
end

test "from prefilled attrs with cookie as a secret" do
test "from stored attrs with cookie as a secret" do
AttributeStore.put_attribute(
{Kino.RemoteExecutionCell, :cookie},
{nil, "COOKIE_SECRET_GLOBAL"}
Expand All @@ -200,7 +200,7 @@ defmodule Kino.RemoteExecutionCellTest do
"""
end

test "attrs precedes globals" do
test "init attrs precedes stored attrs" do
{_kino, source} = start_smart_cell!(RemoteExecutionCell, %{"node" => "name@node@attrs"})

assert source == """
Expand All @@ -210,7 +210,7 @@ defmodule Kino.RemoteExecutionCellTest do
"""
end

test "globals always come from the most recent edited cell" do
test "stored attrs always come from the most recent edited cell" do
{kino, _source} = start_smart_cell!(RemoteExecutionCell, %{})
push_event(kino, "update_field", %{"field" => "node", "value" => "edited@node@name"})
assert_receive {:runtime_smart_cell_update, _, _, _, _}
Expand Down

0 comments on commit cbdcd79

Please sign in to comment.