1.0.8 • Published 1 year ago

@vestaboard/elasticsearch-mocks v1.0.8

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year 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

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago