Skip to content

GannaChernyshova/testcontainers-node-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Testcontainers Node Demo

This repository demonstrates the use of Testcontainers with Node.js for integration testing. Testcontainers is a library that provides throwaway, lightweight instances of databases, message brokers, web browsers, or just about anything that can run in a Docker container.

Prerequisites

Before you begin, ensure you have the following installed on your system:

Detailed Description of Tests

The tests are located in the src/test directory and include:

  1. generic-connection.test.js:

    • Tests the initialization and connection to a generic container.
    • Demonstrates the use of the GenericContainer class for running basic container operations.
  2. wait-container.test.js:

    • Tests various wait strategies to ensure containers are ready before running tests.
    • Demonstrates the use of waiting mechanisms like forLogMessage and forListeningPorts.
  3. network-connection.test.js:

    • Demonstrates how to set up a custom network and ensure communication between containers.
  4. postgres-customer-repository.test.js:

  5. mysql-customer-repository.test.js:

    • Demonstrates the use of the MySQLContainer module for database interactions.
  6. selenium.test.js:

Installation

To get started with this project, follow these steps:

  1. Clone the repository:

    git clone https://github.com/GannaChernyshova/testcontainers-node-demo.git
    cd testcontainers-node-demo
  2. Install dependencies:

    npm install

Running Tests

To run all tests or a single test using Jest, use the following commands:

  1. Run all tests:

    npm test
  2. Run a single test:

    npx jest src/test/generic-connection.test.js

This will execute the specified test file using Jest.

Useful Links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published