Skip to content

Commit

Permalink
docs: update README with snapshot description
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosvega91 committed Apr 28, 2021
1 parent eefa978 commit 1a5e22a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,23 @@ const db = factory({...})
drop(db)
```

#### `snapshot`

Create a snapshot for entities present in the database.
The snapshot is useful to restore the database later e.g. between tests.

```js
import { factory, snapshot } from '@mswjs/data'

const db = factory({...})

const restore = snapshot(db)

// Make some update to the database

restore()
```

### Usage with `faker`

Libraries like [`faker`](https://github.com/Marak/Faker.js) can help you generate fake data for your models.
Expand Down

0 comments on commit 1a5e22a

Please sign in to comment.