1.0.8 • Published 2 years ago

@vestaboard/elasticsearch-mocks v1.0.8

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

ElasticSearch Mocks

This is an in-memory ElasticSearch mock library. It currently only supports a small subset of the large ElasticSearch API, but more overrides may be added over time as use-cases come up. The idea is to be able to run in-memory unit tests without needing to interact with the actual ElasticSearch IO. Please note that this is not a replacement for integration or end to end test strategies and edge cases will likely be identified and corrected.

Installation

yarn add @vestaboard/elasticsearch-mocks --dev

or

npm i @vestaboard/elasticsearch-mocks --save-dev

Usage

// Before importing the real ElasticSearch module
import * as elasticSearchMocks from "@vestaboard/elasticsearch-mocks";

jest.mock("@elastic/elasticsearch", () => elasticSearchMocks);

// Profit!

Supported Mocks

So far, we have overrides for the following methods:

  • count()
  • delete()
  • index()
  • query()

All other methods will currently hit the real ElasticSearch

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago