Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit fd3e420

Browse files
byronbyronz
authored andcommitted
✅ add test clear data
1 parent 99a4eda commit fd3e420

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

tests/integration/store/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
UUID = "store-test-{}".format(uuid.uuid4().hex)
1111

12+
1213
@pytest.fixture(scope="module")
1314
def store_app():
1415
app = dash.Dash(__name__)
@@ -30,6 +31,8 @@ def store_app():
3031
[State("memory", "data")],
3132
)
3233
def write_memory(modified_ts, data):
34+
if data is None:
35+
return ""
3336
return json.dumps(data)
3437

3538
@app.callback(
@@ -43,7 +46,7 @@ def write_memory(modified_ts, data):
4346
def on_clear(n_clicks):
4447
if n_clicks is None:
4548
raise PreventUpdate
46-
return True
49+
return True, True, True
4750

4851
@app.callback(
4952
[
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
def test_stcd001_clear_data_on_all_types(store_app, dash_duo):
2+
3+
dash_duo.start_server(store_app)
4+
5+
assert dash_duo.wait_for_contains_text("#output", store_app.uuid)
6+
7+
dash_duo.multiple_click("#btn", 3)
8+
assert dash_duo.local_storage == {"n_clicks": 3}
9+
10+
dash_duo.find_element("#clear-btn").click()
11+
12+
assert (
13+
not dash_duo.find_element("#output").text
14+
and not dash_duo.local_storage
15+
and not dash_duo.session_storage
16+
), "the clear_data should clear all data in three storage types"

0 commit comments

Comments
 (0)