Эх сурвалжийг харах

chore: verify customer module integration

ChenYu 4 сар өмнө
parent
commit
f4926c7ecb

+ 7 - 9
backend/test/auth.e2e-spec.ts

@@ -72,15 +72,13 @@ describe('Auth (e2e)', () => {
       .set('Authorization', token)
       .expect(200);
 
-    expect(response.body).toEqual({
-      ok: true,
-      data: {
-        items: [],
-        total: 0,
-        page: 1,
-        pageSize: 20,
-      },
-      error: null,
+    expect(response.body.ok).toBe(true);
+    expect(response.body.error).toBeNull();
+    expect(response.body.data).toEqual({
+      items: expect.any(Array),
+      total: expect.any(Number),
+      page: 1,
+      pageSize: 20,
     });
   });
 });

+ 5 - 5
frontend/src/pages/dashboard/simulation/StylistSimulationPage.tsx

@@ -36,13 +36,13 @@ export function StylistSimulationPage() {
   const pageCopy = copy.stylistSimulationPage
 
   useEffect(() => {
-    listCustomers().then((items) => {
-      setCustomers(items)
+    listCustomers().then((result) => {
+      setCustomers(result.items)
       const preset = simulationSession.getCustomerId()
-      if (preset && items.some((item) => item.id === preset)) {
+      if (preset && result.items.some((item) => item.id === preset)) {
         setSelectedCustomerId(preset)
-      } else if (items.length > 0) {
-        setSelectedCustomerId(items[0].id)
+      } else if (result.items.length > 0) {
+        setSelectedCustomerId(result.items[0].id)
       }
     })
     listAftercareOptions().then(setAftercareOptions)