summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2021-01-17 15:28:54 +0000
committerGitHub <noreply@github.com>2021-01-17 16:28:54 +0100
commit7db0605d456559f1ca9447e6fa778559fe50cc95 (patch)
tree8607446306b6e526dab149a465cac3e3d825b96b /cli/tests
parentf4dbb267c6672f92605bc204b10ad9a96d160ef4 (diff)
fix(op_crates/web): Use WorkerLocation for location in workers (#9084)
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/070_location.ts.out2
-rw-r--r--cli/tests/079_location_authentication.ts1
-rw-r--r--cli/tests/079_location_authentication.ts.out3
-rw-r--r--cli/tests/integration_tests.rs5
-rw-r--r--cli/tests/subdir/worker_location.ts4
-rw-r--r--cli/tests/workers_test.ts2
6 files changed, 13 insertions, 4 deletions
diff --git a/cli/tests/070_location.ts.out b/cli/tests/070_location.ts.out
index 66d470b6f..2ba0f259d 100644
--- a/cli/tests/070_location.ts.out
+++ b/cli/tests/070_location.ts.out
@@ -6,12 +6,10 @@ Location {
hostname: [Getter/Setter],
href: [Getter/Setter],
origin: [Getter],
- password: [Getter/Setter],
pathname: [Getter/Setter],
port: [Getter/Setter],
protocol: [Getter/Setter],
search: [Getter/Setter],
- username: [Getter/Setter],
ancestorOrigins: [Getter],
assign: [Function: assign],
reload: [Function: reload],
diff --git a/cli/tests/079_location_authentication.ts b/cli/tests/079_location_authentication.ts
new file mode 100644
index 000000000..4989312ac
--- /dev/null
+++ b/cli/tests/079_location_authentication.ts
@@ -0,0 +1 @@
+console.log(location.href);
diff --git a/cli/tests/079_location_authentication.ts.out b/cli/tests/079_location_authentication.ts.out
new file mode 100644
index 000000000..bb2458497
--- /dev/null
+++ b/cli/tests/079_location_authentication.ts.out
@@ -0,0 +1,3 @@
+[WILDCARD]
+https://baz/qux
+[WILDCARD]
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index 586c405e3..9c64a9e07 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -2651,6 +2651,11 @@ itest!(_078_unload_on_exit {
output: "078_unload_on_exit.ts.out",
});
+itest!(_079_location_authentication {
+ args: "run --location https://foo:bar@baz/qux 079_location_authentication.ts",
+ output: "079_location_authentication.ts.out",
+});
+
itest!(js_import_detect {
args: "run --quiet --reload js_import_detect.ts",
output: "js_import_detect.ts.out",
diff --git a/cli/tests/subdir/worker_location.ts b/cli/tests/subdir/worker_location.ts
index 480032350..89fa83036 100644
--- a/cli/tests/subdir/worker_location.ts
+++ b/cli/tests/subdir/worker_location.ts
@@ -1,4 +1,6 @@
onmessage = function (): void {
- postMessage(self.location.href);
+ postMessage(
+ `${location.href}, ${location instanceof WorkerLocation}`,
+ );
close();
};
diff --git a/cli/tests/workers_test.ts b/cli/tests/workers_test.ts
index 2ea6f6cf5..66444411e 100644
--- a/cli/tests/workers_test.ts
+++ b/cli/tests/workers_test.ts
@@ -648,7 +648,7 @@ Deno.test({
new URL("subdir/worker_location.ts", import.meta.url).href;
const w = new Worker(workerModuleHref, { type: "module" });
w.onmessage = (e): void => {
- assertEquals(e.data, workerModuleHref);
+ assertEquals(e.data, `${workerModuleHref}, true`);
promise.resolve();
};
w.postMessage("Hello, world!");