summaryrefslogtreecommitdiffstats
path: root/src/__tests__/navigation-test.tsx
diff options
context:
space:
mode:
authorAlberto Duarte Delgado <alberto@albertoduarte.com>2026-03-25 15:32:20 +0000
committerAlberto Duarte Delgado <alberto@albertoduarte.com>2026-03-25 15:32:20 +0000
commit7809ccbba56be8c5377f94cf2d287a0e1521fdc1 (patch)
tree1c590049df5546f141eeb3bf58ad5ea9d1e0fbf6 /src/__tests__/navigation-test.tsx
parentd071a19fdeb0fc369e356004118f59a7fe4fed91 (diff)
Initial commit: App Oficina base project
Diffstat (limited to 'src/__tests__/navigation-test.tsx')
-rw-r--r--src/__tests__/navigation-test.tsx32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/__tests__/navigation-test.tsx b/src/__tests__/navigation-test.tsx
new file mode 100644
index 0000000..4123ab7
--- /dev/null
+++ b/src/__tests__/navigation-test.tsx
@@ -0,0 +1,32 @@
+import { renderRouter, screen, fireEvent } from 'expo-router/testing-library';
+import React from "react";
+import { Text } from "react-native";
+
+/**
+ * Mock mínimo de las rutas reales
+ * No renderiza toda la app, solo lo necesario
+ */
+describe("Navegación index → crearUsuario", () => {
+ it("navega a la pantalla Crear Usuario al pulsar el botón", async () => {
+ renderRouter(
+ {
+ index: require("../app/index").default,
+ crearUsuario: require("../app/crearUsuario").default,
+ },
+ {
+ initialUrl: "/",
+ }
+ );
+
+ // Estamos en index
+ expect(screen.getByText("crear usuario")).toBeTruthy();
+
+ // Pulsamos el botón
+ fireEvent.press(screen.getByTestId("btn-crear-usuario"));
+
+ // Ahora debe renderizarse crearUsuario
+ expect(
+ await screen.findByText("Crear Usuario")
+ ).toBeTruthy();
+ });
+});