forked from pubkey/rxdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.test.js
More file actions
27 lines (21 loc) · 730 Bytes
/
App.test.js
File metadata and controls
27 lines (21 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import React from 'react';
import { isRxDatabase } from 'rxdb';
import initializeDb, { HeroesCollectionName } from "./initializeDb";
const testDocument = {
name: 'test',
color: '#A47706'
}
let db;
it('Database initialization', async () => {
db = await initializeDb();
expect(isRxDatabase(db)).toBeTruthy();
});
it(`Add test doc and fetch it from ${HeroesCollectionName} collection`, async () => {
await db.collections[HeroesCollectionName].upsert(testDocument);
const docs = await db.collections[HeroesCollectionName].find({ selector: { name: testDocument.name }}).exec();
expect(docs.length).toBe(1);
});
it(`Destroy db`, async () => {
await db.destroy();
expect(true).toBeTruthy();
});