All Projects → davesag → mock-algolia

davesag / mock-algolia

Licence: MIT license
A mock server for the Algolia search engine allowing integration testing without the need to hit Algolia's actual servers

Programming Languages

javascript
184084 projects - #8 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to mock-algolia

algoliasearch-client-kotlin
⚡️ A fully-featured and blazing-fast Kotlin/Android API client to interact with Algolia.
Stars: ✭ 45 (+150%)
Mutual labels:  algolia, algolia-api
TorXakis
A tool for Model Based Testing
Stars: ✭ 40 (+122.22%)
Mutual labels:  testing-tool
use-algolia
Dead-simple React hook to make Algolia search queries. Supports pagination out of the box.
Stars: ✭ 29 (+61.11%)
Mutual labels:  algolia
scalatest-junit-runner
JUnit 5 runner for Scalatest
Stars: ✭ 30 (+66.67%)
Mutual labels:  testing-tool
wiremock
A tool for mocking HTTP services
Stars: ✭ 5,239 (+29005.56%)
Mutual labels:  mock-server
karate
Test Automation Made Simple
Stars: ✭ 6,384 (+35366.67%)
Mutual labels:  mock-server
talksearch
🎤 An interactive search experience for video titles and transcripts
Stars: ✭ 24 (+33.33%)
Mutual labels:  algolia
mock-json-server
A mock web server using a JSON file with live-reload support.
Stars: ✭ 31 (+72.22%)
Mutual labels:  mock-server
vcr.js
Mock server with Proxy and Record support inspired by ruby VCR.
Stars: ✭ 41 (+127.78%)
Mutual labels:  mock-server
kb-proxy
kb-proxy 是一个可本地部署的、提供代理功能、接口测试管理、支持在线Mock、Host环境管理的在线工具平台。
Stars: ✭ 52 (+188.89%)
Mutual labels:  mock-server
main
Mocks Server monorepo
Stars: ✭ 109 (+505.56%)
Mutual labels:  mock-server
PixelTest
Fast, modern, simple iOS snapshot testing written purely in Swift.
Stars: ✭ 56 (+211.11%)
Mutual labels:  testing-tool
Pure
Pure is a free social networking App. it is simple, reliable and it makes it easy to keep in touch with your friends and family. Pure works across mobile devices even on slow internet connections.
Stars: ✭ 28 (+55.56%)
Mutual labels:  algolia
angular-search-experience
Algolia + Angular = 🔥🔥🔥
Stars: ✭ 166 (+822.22%)
Mutual labels:  algolia
manta-style
🚀 The futuristic API Mock Server for Frontend
Stars: ✭ 41 (+127.78%)
Mutual labels:  mock-server
nearo
🔥 Nearo: A react.js app for local selling, buying, and news
Stars: ✭ 40 (+122.22%)
Mutual labels:  algolia
volder
volder is powerful Object schema validation lets you describe your data using a simple and readable schema and transform a value to match the requirements
Stars: ✭ 106 (+488.89%)
Mutual labels:  testing-tool
instantsearch-core-swift
⚡️ InstantSearch Core library for Swift and Objective-C
Stars: ✭ 18 (+0%)
Mutual labels:  algolia
json-server
Create a dummy REST API from a json file with zero coding in seconds
Stars: ✭ 34 (+88.89%)
Mutual labels:  mock-server
pytest-testrail
pytest plugin for integration with TestRail, for creating testruns and updating results
Stars: ✭ 88 (+388.89%)
Mutual labels:  testing-tool

mock-algolia

A mock server that mimics the Algolia Search and Indexing APIs.

Docker

Links

Current Status

This is very much version 0.0.x and a hack, not a fully fledged system.

  • Very minimal support for adding, updating, and removing data from indices.
  • No search queries supported yet (coming when I need them/get around to them)
  • I've not written unit or integration tests for the main routes.

To Use

I am going to assume you are using the Algolia Javascript API Client here, but if not then similar patterns will apply.

Prep the client

Normally you'd do this

const client = algoliasearch(applicationId, apiKey)
const index = client.initIndex('some-index-name')

await index.addObjects(arrayOfObjects)

To fool the algoliasearch client into talking to this mock server, do this instead:

const client = algoliasearch(applicationId, apiKey, { protocol: 'http:' })
client.hosts = {
  read: ['http://localhost:3000'],
  write: ['http://localhost:3000']
}

const index = client.initIndex('some-index-name')

await index.addObjects(arrayOfObjects)

Then all the client requests will go to the mock server (assuming it's running on port 3000)

Checking what was sent

You can get a quick overview of what has been sent to the mock server via get `/requests'.

Resetting the mock server

You can reset the request log by sending [delete /requests]

Configuration

Set the following environment variables

Variable Default Notes
PORT 3000 The port the server listens on

Development

Branches

Branch Tests Code Coverage Audit Comments
develop CircleCI codecov Vulnerabilities Work in progress
main CircleCI codecov Vulnerabilities Latest Production Release

Prerequisites

  • NodeJS. I use nvm to manage Node versions — brew install nvm.
  • Docker if you want to use the Swagger Editor. (Use Docker for Mac, not the homebrew version)

To build and run locally

Clone this (or better yet, fork it then clone your fork)

npm install
npm start

Go to localhost:3000/docs to see the docs.

.env file

You can put environment variables in a .env file.

Testing

  • npm test to run the unit tests
  • npm run test:server will run the integration tests
  • npm run lint will lint it
  • npm run prettier will prettify it
  • npm run test:unit:cov will run the unit tests with code coverage

Contributing

Please see the contributing notes.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].