summaryrefslogtreecommitdiff
path: root/test/yomichan-vm.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-08-15 17:22:23 -0400
committerGitHub <noreply@github.com>2020-08-15 17:22:23 -0400
commitd8649f40d59356361ce470cc220dca6c62a66388 (patch)
tree15f4fe00721375aa77afe2e840d22e85b10dace3 /test/yomichan-vm.js
parent587822c16e3f573362fdfe291c9afc37ca31bb15 (diff)
JSON-schema-based profile conditions (#730)
* Add ProfileConditions class * Add URL to VM * Add new ProfileConditions tests
Diffstat (limited to 'test/yomichan-vm.js')
-rw-r--r--test/yomichan-vm.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/yomichan-vm.js b/test/yomichan-vm.js
index 97faa03e..79e92772 100644
--- a/test/yomichan-vm.js
+++ b/test/yomichan-vm.js
@@ -115,8 +115,29 @@ function deepStrictEqual(actual, expected) {
}
+function createURLClass() {
+ const BaseURL = URL;
+ return function URL(url) {
+ const u = new BaseURL(url);
+ this.hash = u.hash;
+ this.host = u.host;
+ this.hostname = u.hostname;
+ this.href = u.href;
+ this.origin = u.origin;
+ this.password = u.password;
+ this.pathname = u.pathname;
+ this.port = u.port;
+ this.protocol = u.protocol;
+ this.search = u.search;
+ this.searchParams = u.searchParams;
+ this.username = u.username;
+ };
+}
+
+
class VM {
constructor(context={}) {
+ context.URL = createURLClass();
this._context = vm.createContext(context);
this._assert = {
deepStrictEqual