From 68bec03d0b506e29a534aa617a52d329ef95e606 Mon Sep 17 00:00:00 2001 From: Sean Doyle Date: Mon, 23 Oct 2023 17:01:09 +0200 Subject: [PATCH] Add test coverage for `StreamActions` export (#1023) According to the [official documentation][], applications that need to extend `StreamActions` should be importing it directly from the module instead of accessing it through `window.Turbo.StreamActions`. This commit adds test coverage to exercise the corresponding `import`. It also re-arranges the `export` to explicitly occur in the `@hotwired/turbo` module itself, instead of being transitively exported as part of the `@hotwired/turbo/core` module. [official documentation]: https://turbo.hotwired.dev/handbook/streams#custom-actions --- src/tests/unit/export_tests.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tests/unit/export_tests.js b/src/tests/unit/export_tests.js index be46c8160..8d590b8c1 100644 --- a/src/tests/unit/export_tests.js +++ b/src/tests/unit/export_tests.js @@ -1,7 +1,9 @@ import { assert } from "@open-wc/testing" -import * as Turbo from "../../index" +import * as Turbo from "../../" +import { StreamActions } from "../../" test("test Turbo interface", () => { + assert.equal(typeof Turbo.StreamActions, "object") assert.equal(typeof Turbo.start, "function") assert.equal(typeof Turbo.registerAdapter, "function") assert.equal(typeof Turbo.visit, "function") @@ -16,3 +18,7 @@ test("test Turbo interface", () => { assert.equal(typeof Turbo.navigator, "object") assert.equal(typeof Turbo.session, "object") }) + +test("test StreamActions interface", () => { + assert.equal(typeof StreamActions, "object") +})