Skip to content

Commit 6f4849b

Browse files
committed
update readme and fix audit
1 parent 04bed77 commit 6f4849b

File tree

4 files changed

+35
-11
lines changed

4 files changed

+35
-11
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
env: {
33
node: true,
4-
es2021: true,
4+
es2022: true,
55
},
66
extends: [
77
'eslint:recommended',

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Jest preset for running tests with local ElasticSearch, OpenSearch and ZincSearc
1313

1414
ElasticSearch and OpenSearch relies on Java, please make sure you have Java installed and `JAVA_HOME` is set.
1515

16+
`jest-search` provide two ways to set up, one is two set up globally, another is running in specific test only
17+
18+
### set up globally
1619
**1. install library**
1720

1821
```bash
@@ -138,8 +141,29 @@ beforeAll(async () => {
138141
await saveBook(mockBook);
139142
});
140143
```
144+
### specific test only
145+
the step 1 and 2 are the same as above, `jest-search` export two methods `startEngine` and `stopEngine` to start and stop the search engine, you can manually call them in your test file, the `startEngine` accepts same argument object as defined in `jest-search-config.js` file
146+
```typescript
147+
import { startEngine, stopEngine } from '@geek-fun/jest-search';
148+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
149+
// @ts-ignore
150+
import loadConfig from '../jest-search-config.js';
151+
152+
153+
describe('integration test for elasticsearch', () => {
154+
beforeAll(async () => {
155+
await startEngine(loadConfig());
156+
await saveBook(mockBook);
157+
});
158+
afterAll(async () => {
159+
await stopEngine();
160+
});
161+
it('should get book when search with valid book name', async () => {
162+
// ...
163+
});
164+
});
141165

142-
166+
```
143167

144168
### Known issues
145169

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@geek-fun/jest-search",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"main": "dist/src/index.js",
55
"types": "dist/src/index.d.ts",
66
"description": "Jest preset for running tests with local search platform",

0 commit comments

Comments
 (0)