ioredis-mock
Advanced tools
Comparing version 5.4.1 to 5.5.0
@@ -19,7 +19,7 @@ "use strict"; | ||
switch (position) { | ||
case `BEFORE`: | ||
case 'BEFORE': | ||
elementIndex = pivotIndex; | ||
break; | ||
case `AFTER`: | ||
case 'AFTER': | ||
elementIndex = pivotIndex + 1; | ||
@@ -29,3 +29,3 @@ break; | ||
default: | ||
throw new Error(`The position of the new element must be BEFORE the pivot or AFTER the pivot`); | ||
throw new Error('The position of the new element must be BEFORE the pivot or AFTER the pivot'); | ||
} | ||
@@ -32,0 +32,0 @@ |
@@ -31,2 +31,3 @@ "use strict"; | ||
/* eslint-disable max-classes-per-file */ | ||
const defaultOptions = { | ||
@@ -151,2 +152,13 @@ data: {}, | ||
}; | ||
module.exports = RedisMock; | ||
class RedisClusterMock extends RedisMock { | ||
constructor(nodesOptions) { | ||
super(); | ||
this.nodes = []; | ||
nodesOptions.forEach(options => this.nodes.push(new RedisMock(options))); | ||
} | ||
} | ||
module.exports = RedisMock; | ||
module.exports.Cluster = RedisClusterMock; |
@@ -21,2 +21,4 @@ { | ||
"scripts": { | ||
"build:babel": "npx rimraf lib && npx mkdirp lib && babel src --out-dir lib", | ||
"build:jest.js": "esbuild src/index.js --bundle --external:fengari --external:fengari-interop --external:lodash --external:minimatch --external:standard-as-callback --outfile=jest.js --platform=node --target=node10", | ||
"codeclimate": "codeclimate-test-reporter < ./coverage/lcov.info", | ||
@@ -27,4 +29,2 @@ "precoverage": "npx rimraf coverage && npx mkdirp coverage", | ||
"lint": "eslint .", | ||
"build:babel": "npx rimraf lib && npx mkdirp lib && babel src --out-dir lib", | ||
"build:jest.js": "esbuild src/index.js --bundle --external:fengari --external:fengari-interop --external:lodash --external:minimatch --external:standard-as-callback --outfile=jest.js --platform=node --target=node10", | ||
"prepublishOnly": "yarn build:babel && yarn build:jest.js", | ||
@@ -56,3 +56,3 @@ "semantic-release": "semantic-release pre && npm publish && semantic-release post", | ||
"coveralls": "^3.1.0", | ||
"esbuild": "^0.9.6", | ||
"esbuild": "^0.11.0", | ||
"eslint": "^7.13.0", | ||
@@ -120,2 +120,6 @@ "eslint-config-airbnb-base": "^14.2.1", | ||
}, | ||
"prettier": { | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
}, | ||
"release": { | ||
@@ -127,3 +131,3 @@ "prepare": [ | ||
"runkitExampleFilename": "example.js", | ||
"version": "5.4.1" | ||
"version": "5.5.0" | ||
} |
@@ -1,2 +0,2 @@ | ||
# ioredis-mock · [](https://npm-stat.com/charts.html?package=ioredis-mock) [](https://www.npmjs.com/package/ioredis-mock) [](compat.md) [](https://github.com/semantic-release/semantic-release) | ||
# ioredis-mock · [](https://npm-stat.com/charts.html?package=ioredis-mock) [](https://www.npmjs.com/package/ioredis-mock) [](compat.md) [](https://github.com/semantic-release/semantic-release) | ||
@@ -125,2 +125,14 @@ This library emulates [ioredis](https://github.com/luin/ioredis) by performing | ||
### Cluster(Experimental) | ||
Work on Cluster support has started, the current implementation is minimal and PRs welcome #359 | ||
```js | ||
var Redis = require('ioredis-mock'); | ||
const cluster = new Redis.Cluster(['redis://localhost:7001']); | ||
const nodes = cluster.nodes; | ||
expect(nodes.length).toEqual(1); | ||
``` | ||
## Roadmap | ||
@@ -127,0 +139,0 @@ |
Sorry, the diff of this file is too big to display
481823
15710
159