Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Collection of Ionic Mocks for Use in Every Project

Abierto
#21 7 comentarios 4 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
typescript
Área
testing

Línea de trabajo

Comienza revisando el archivo referenciado Clicker src/mocks.ts, el gist enlazado y la discusión de siete comentarios. El issue no define qué mocks de Ionic se deben incluir, dónde deben ubicarse ni cómo se deben validar, por lo que habría que acordar el alcance y los criterios de aceptación antes de la implementación.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

EDIT: I just realized that the main place I've grabbed Ionic mock from was the Clicker project. mocks.ts. Thanks to @lathonez for making this file available.

I created this issue to begin a discussion around mock objects in Ionic (and I'm not sure where else to have this discussion).

I've been doing a lot of unit testing lately for an Ionic 2 application. One of the things I've found to be very helpful is that there appear to be many mock objects available out there for use in Ionic unit testing. I've put together a few objects that I've needed in a current project into one file so that I can reference them. Take a look.

FYI:

  1. While I have made adjustments to this code, it is not mine. I've found these objects sprinkled over Stack Overflow and else where.
  2. These mocks are working for me, but Your Mileage May Vary.

Here's my issue. For this project, having reliable Ionic mocks is important. We should be unit testing our applications, not the Ionic Framework. There is no reason for each of us to be building their own set of Ionic mocks. As a community, we should be able to assemble these mocks.

Shouldn't we be able to provide mocks for as many of the Ionic pieces that may be needed?

Shouldn't we be able to provide best practices as to where to place these mocks and how to use them?

Re: Best practices: Currently, I have three files in my project:

  • src/testing/mock-ionic.ts: Ionic mocks
  • src/testing/mock-app.ts: mocks of object created in my project
  • src/testing/mock-data.ts: mock data that I can use with my mock services

This is how I've organized my current project. Again, YMMV.

Let the discussion begin.

Lenguaje dominante
TypeScript
Estrellas
370
Forks
144
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ionic-team/ionic-unit-testing-example

Todos los issues de ionic-team/ionic-unit-testing-example

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.