Skip to content

Commit

Permalink
update readme and fix audit
Browse files Browse the repository at this point in the history
  • Loading branch information
Blankll committed Jul 24, 2023
1 parent 04bed77 commit 6f4849b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
env: {
node: true,
es2021: true,
es2022: true,
},
extends: [
'eslint:recommended',
Expand Down
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Jest preset for running tests with local ElasticSearch, OpenSearch and ZincSearc

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

`jest-search` provide two ways to set up, one is two set up globally, another is running in specific test only

### set up globally
**1. install library**

```bash
Expand Down Expand Up @@ -138,8 +141,29 @@ beforeAll(async () => {
await saveBook(mockBook);
});
```
### specific test only
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
```typescript
import { startEngine, stopEngine } from '@geek-fun/jest-search';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import loadConfig from '../jest-search-config.js';


describe('integration test for elasticsearch', () => {
beforeAll(async () => {
await startEngine(loadConfig());
await saveBook(mockBook);
});
afterAll(async () => {
await stopEngine();
});
it('should get book when search with valid book name', async () => {
// ...
});
});


```

### Known issues

Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@geek-fun/jest-search",
"version": "1.0.2",
"version": "1.0.3",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
"description": "Jest preset for running tests with local search platform",
Expand Down

0 comments on commit 6f4849b

Please sign in to comment.