Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

138
Vistas
Testing NodeJS and SQL database integration

What would be the best practice setup for running tests that involved some integration of a NodeJS API and a database?

In addition to unit tests, it'd be great if I could seed the database with some dummy data and test various behaviors on this data.

In these cases is it best to have a test database sitting there solely for the purpose of testing? E.g. in AWS there'd be an RDS instance always on, that CI tools would point to and have permissions for.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

What I tend to do here is to create fixture objects that represent common objects I'd use to test. So a Car model might have a Camero fixture object, that I then instantiate in my unit tests to do something with.

Read this as: I create any objects I need to test with in the unit tests themselves, then make sure to delete the data after my test. I don't pre-populate the database with test objects, because I may want to create a Red Camera, or a Camero With Three Wheels Camero for some test I'm doing.

For MEAN apps in the past I've had good luck with FactoryLady. It claims it only assumes a "save" method exists on your objects, so it should be usable with some SQL ORM you're using.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda