From c5c00e4da73e2eefd9f75f21b8321f0ba7ff2188 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Fri, 21 Apr 2023 07:35:03 -0300
Subject: moving libs to web utils, apply new mock api to backoffice

---
 packages/merchant-backoffice-ui/src/hooks/testing.tsx | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'packages/merchant-backoffice-ui/src/hooks/testing.tsx')

diff --git a/packages/merchant-backoffice-ui/src/hooks/testing.tsx b/packages/merchant-backoffice-ui/src/hooks/testing.tsx
index 67831f8a4..132c5f166 100644
--- a/packages/merchant-backoffice-ui/src/hooks/testing.tsx
+++ b/packages/merchant-backoffice-ui/src/hooks/testing.tsx
@@ -71,16 +71,19 @@ export class ApiMockEnvironment extends MockEnvironment {
             request: options.data,
           },
         );
+        const status = mocked.expectedQuery?.query.code ?? 200;
+        const requestPayload = mocked.expectedQuery?.params?.request;
+        const responsePayload = mocked.expectedQuery?.params?.response;
 
         return {
           ok: true,
-          data: (!mocked ? undefined : mocked.payload) as T,
+          data: responsePayload as T,
           loading: false,
           clientError: false,
           serverError: false,
           info: {
             hasToken: !!options.token,
-            status: !mocked ? 200 : mocked.status,
+            status,
             url: _url.href,
             payload: options.data,
             options: {},
-- 
cgit v1.2.3

