From 0a6f725c95550952b98f5fc5f1c59e02877f1684 Mon Sep 17 00:00:00 2001 From: Christa Date: Mon, 29 Jul 2024 12:05:53 -0400 Subject: [PATCH] implement the useGlobal mock --- @empirica-mocks/core/mockImpl.test.js | 0 @empirica-mocks/core/mocks.js | 20 ++++++++++++++++++++ deliberation-empirica | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 @empirica-mocks/core/mockImpl.test.js diff --git a/@empirica-mocks/core/mockImpl.test.js b/@empirica-mocks/core/mockImpl.test.js new file mode 100644 index 0000000..e69de29 diff --git a/@empirica-mocks/core/mocks.js b/@empirica-mocks/core/mocks.js index 6b88a6b..a81c715 100644 --- a/@empirica-mocks/core/mocks.js +++ b/@empirica-mocks/core/mocks.js @@ -1,3 +1,5 @@ +import { isFunctionDeclaration } from "typescript"; + export function usePlayer() { // This is a mock function that returns a mock player object console.log("loaded usePlayer() from react-mocks.js"); @@ -73,3 +75,21 @@ export function usePlayers() { return players; } + +// Mock implementation of useGlobal +export function useGlobal() { + // This is a mock function that returns a mock global object + const global = { + isMock: true, + recruitingBatchConfig: { + cdn: 'local', + }, + resourceLookup: { + cdn: 'local', + }, + get: (varName) => { + return this[varName]; + } + }; + return global; +} diff --git a/deliberation-empirica b/deliberation-empirica index ebc13a6..7014bfd 160000 --- a/deliberation-empirica +++ b/deliberation-empirica @@ -1 +1 @@ -Subproject commit ebc13a6421b3737fdcbdd81a436a573b3059a1eb +Subproject commit 7014bfd041cfa4ee6c47ca542bda2e6353f8942c