4.0.1 • Published 4 years ago
@advanced-rest-client/arc-data-generator v4.0.1
ArcMock
Generates data for ARC demo pages and tests scenarios.
Note API surface changed in version 4.x.
Usage
Installation
npm install --save @advanced-rest-client/arc-data-generator
In a test scenario
import { assert } from '@open-wc/testing';
import { ArcMock } from '@advanced-rest-client/arc-data-generator';
describe('Action', () => {
before(async () => {
const generator = new ArcMock();
await generator.store.insertSavedIfNotExists();
});
it('has request data', () => {
// ...
});
});
Using the store
namespace
The store
namespace (or the Store
class) requires a reference to the PouchDB database. Because PouchDB has a legacy architecture, NodeJS and a browser imports the code differently. This means that your test scenario has to import PouchDB and set the reference to the PouchDB class in the init options.
// in NodeJS
import PouchDB from 'pouchdb';
import { ArcMock } from '@advanced-rest-client/arc-data-generator';
const mock = new ArcMock({ store: PouchDB });
// in a browser
import 'pouchdb/dist/pouchdb.js';
import { ArcMock } from '@advanced-rest-client/arc-data-generator';
/* global PouchDB */
const mock = new ArcMock({ store: PouchDB });
Development
git clone https://github.com/advanced-rest-client/arc-data-generator
cd arc-data-generator
npm install
Running the tests
npm test
4.0.1
4 years ago
4.0.0
4 years ago
3.2.3
4 years ago
3.2.2
4 years ago
3.2.1
4 years ago
3.2.0
4 years ago
3.1.12
5 years ago
3.1.11
5 years ago
3.1.10
5 years ago
3.1.9
5 years ago
3.1.8
5 years ago
3.1.7
5 years ago
3.1.6
5 years ago
3.1.5
5 years ago
3.1.4
5 years ago
3.1.3
5 years ago
3.1.2
5 years ago
3.1.1
5 years ago
3.1.0
5 years ago
3.0.7
5 years ago
3.0.6
6 years ago
3.0.5
6 years ago
3.0.4
6 years ago
3.0.3
6 years ago
3.0.2
6 years ago
3.0.1
6 years ago
3.0.0
6 years ago
3.0.0-preview.1
6 years ago