summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/js_unit_tests.rs1
-rw-r--r--cli/tests/testdata/jupyter/integration_test.ipynb51
-rw-r--r--cli/tests/unit/jupyter_test.ts9
3 files changed, 60 insertions, 1 deletions
diff --git a/cli/tests/integration/js_unit_tests.rs b/cli/tests/integration/js_unit_tests.rs
index 4bb2ef73b..a13db02d7 100644
--- a/cli/tests/integration/js_unit_tests.rs
+++ b/cli/tests/integration/js_unit_tests.rs
@@ -45,6 +45,7 @@ util::unit_test_factory!(
internals_test,
intl_test,
io_test,
+ jupyter_test,
kv_test,
kv_queue_test_no_db_close,
kv_queue_undelivered_test,
diff --git a/cli/tests/testdata/jupyter/integration_test.ipynb b/cli/tests/testdata/jupyter/integration_test.ipynb
index e9347750d..1d48c8fc9 100644
--- a/cli/tests/testdata/jupyter/integration_test.ipynb
+++ b/cli/tests/testdata/jupyter/integration_test.ipynb
@@ -665,9 +665,58 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"id": "8e93df23-06eb-414b-98d4-51fbebb53d1f",
"metadata": {},
+ "outputs": [
+ {
+ "ename": "TypeError",
+ "evalue": "Cannot read properties of undefined (reading 'broadcast')",
+ "output_type": "error",
+ "traceback": [
+ "Stack trace:",
+ "TypeError: Cannot read properties of undefined (reading 'broadcast')",
+ " at <anonymous>:2:20"
+ ]
+ }
+ ],
+ "source": [
+ "await Deno.jupyter.broadcast(\"display_data\", {\n",
+ " data: { \"text/html\": \"<b>Processing.</b>\" },\n",
+ " metadata: {},\n",
+ " transient: { display_id: \"progress\" }\n",
+ "});\n",
+ "\n",
+ "await new Promise((resolve) => setTimeout(resolve, 500));\n",
+ "\n",
+ "await Deno.jupyter.broadcast(\"update_display_data\", {\n",
+ " data: { \"text/html\": \"<b>Processing..</b>\" },\n",
+ " metadata: {},\n",
+ " transient: { display_id: \"progress\" }\n",
+ "});\n",
+ "\n",
+ "await new Promise((resolve) => setTimeout(resolve, 500));\n",
+ "\n",
+ "await Deno.jupyter.broadcast(\"update_display_data\", {\n",
+ " data: { \"text/html\": \"<b>Processing...</b>\" },\n",
+ " metadata: {},\n",
+ " transient: { display_id: \"progress\" }\n",
+ "});\n",
+ "\n",
+ "await new Promise((resolve) => setTimeout(resolve, 500));\n",
+ "\n",
+ "await Deno.jupyter.broadcast(\"update_display_data\", {\n",
+ " data: { \"text/html\": \"<b>Complete ✅</b>\" },\n",
+ " metadata: {},\n",
+ " transient: { display_id: \"progress\" }\n",
+ "});"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "0181f28e",
+ "metadata": {},
"outputs": [],
"source": []
}
diff --git a/cli/tests/unit/jupyter_test.ts b/cli/tests/unit/jupyter_test.ts
new file mode 100644
index 000000000..40eaf4623
--- /dev/null
+++ b/cli/tests/unit/jupyter_test.ts
@@ -0,0 +1,9 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+import { assertThrows } from "./test_util.ts";
+
+Deno.test("Deno.jupyter is not available", () => {
+ assertThrows(
+ () => Deno.jupyter,
+ "Deno.jupyter is only available in `deno jupyter` subcommand.",
+ );
+});