Skip to content

Instantly share code, notes, and snippets.

View jfavrod's full-sized avatar

Jason Favrod jfavrod

View GitHub Profile
import md5 from 'md5';
import { QueryConfig, QueryResult } from 'pg';
import { IPGClient } from './interfaces';
/**
* An NPM module for mocking a connection to a PostgreSQL database.
* @author Jason Favrod <[email protected]>
* @example
* ```
* const PGMock2 = require('pgmock2'),
Promise.resolve().then(() => {
console.log("Create a client and set the wallet location");
client = new hfc();
return hfc.newDefaultKeyValueStore({ path: options.wallet_path });
}).then((wallet) => {
console.log("Set wallet path, and associate user ", options.user_id, " with application");
client.setStateStore(wallet);
return client.getUserContext(options.user_id, true);
}).then((user) => {
console.log("Check user is enrolled, and set a query URL in the network");