From 568933b9fa260da8af4c4b5101b7ac00b2f72910 Mon Sep 17 00:00:00 2001 From: ofreyssinet-ledger Date: Mon, 3 Jun 2024 21:01:07 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20(poc):=20Rename=20mocks=20?= =?UTF-8?q?in=20stubs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pocs/xstate-study/app/openAppStateMachine.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pocs/xstate-study/app/openAppStateMachine.ts b/pocs/xstate-study/app/openAppStateMachine.ts index e8a97a6ee..ed0598c45 100644 --- a/pocs/xstate-study/app/openAppStateMachine.ts +++ b/pocs/xstate-study/app/openAppStateMachine.ts @@ -21,7 +21,7 @@ export const APP_NOT_FOUND_ERROR = "App not installed"; export const OPEN_REJECTED_ERROR = "Open app rejected"; export const DEVICE_NOT_ONBOARDED_ERROR = "Device not onboarded"; -async function mockedGetAppAndVersion(): Promise<{ app: string, version: string }> { +async function getAppAndVersionStub(): Promise<{ app: string, version: string }> { console.log("getAppAndVersion"); await new Promise((resolve) => setTimeout(resolve, 1000)); const random = Math.random(); @@ -31,13 +31,13 @@ async function mockedGetAppAndVersion(): Promise<{ app: string, version: string throw new Error(LOCKED_DEVICE_ERROR); // 30% chance of locked device } -async function mockedCloseApp() { +async function closeAppStub() { console.log("closeApp") await new Promise((resolve) => setTimeout(resolve, 1000)); return; } -async function mockedOpenApp(appName: string) { +async function openAppStub(appName: string) { console.log("openApp") if (!appName) throw new Error("No app name provided"); await new Promise((resolve) => setTimeout(resolve, 1000)); @@ -52,9 +52,9 @@ function makeOpenAppMachine(params: { closeApp: () => Promise, openApp: (appName: string) => Promise, } = { - getAppAndVersion: mockedGetAppAndVersion, - closeApp: mockedCloseApp, - openApp: mockedOpenApp, + getAppAndVersion: getAppAndVersionStub, + closeApp: closeAppStub, + openApp: openAppStub, }) { return setup({ types: {