aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/test/javascript/src
diff options
context:
space:
mode:
Diffstat (limited to 'actioncable/test/javascript/src')
-rw-r--r--actioncable/test/javascript/src/unit/action_cable_test.js20
1 files changed, 16 insertions, 4 deletions
diff --git a/actioncable/test/javascript/src/unit/action_cable_test.js b/actioncable/test/javascript/src/unit/action_cable_test.js
index daad900aca..c46f9878d2 100644
--- a/actioncable/test/javascript/src/unit/action_cable_test.js
+++ b/actioncable/test/javascript/src/unit/action_cable_test.js
@@ -6,14 +6,14 @@ const {module, test} = QUnit
module("ActionCable", () => {
module("Adapters", () => {
module("WebSocket", () => {
- test("default is window.WebSocket", assert => {
- assert.equal(ActionCable.adapters.WebSocket, window.WebSocket)
+ test("default is self.WebSocket", assert => {
+ assert.equal(ActionCable.adapters.WebSocket, self.WebSocket)
})
})
module("logger", () => {
- test("default is window.console", assert => {
- assert.equal(ActionCable.adapters.logger, window.console)
+ test("default is self.console", assert => {
+ assert.equal(ActionCable.adapters.logger, self.console)
})
})
})
@@ -41,5 +41,17 @@ module("ActionCable", () => {
assert.equal(consumer.url, testURL)
})
+
+ test("dynamically computes URL from function", assert => {
+ let dynamicURL = testURL
+ const generateURL = () => {
+ return dynamicURL
+ }
+ const consumer = ActionCable.createConsumer(generateURL)
+ assert.equal(consumer.url, testURL)
+
+ dynamicURL = `${testURL}foo`
+ assert.equal(consumer.url, `${testURL}foo`)
+ })
})
})