UNPKG

767 BJavaScriptView Raw
1"use strict";
2
3// Copyright 2017-2018 Jaco Greeff
4// This software may be modified and distributed under the terms
5// of the ISC license. See the LICENSE file for details.
6const mocks = require('./mocks');
7
8const _on = require('./on');
9
10const _send = require('./send');
11
12const state = require('./state');
13
14const _subscribe = require('./subscribe');
15
16const _unsubscribe = require('./unsubscribe');
17
18module.exports = function mockProvider() {
19 const self = state();
20 mocks(self);
21 return {
22 isConnected: () => true,
23 on: (type, sub) => _on(self, type, sub),
24 send: (method, params) => _send(self, method, params),
25 subscribe: (method, ...params) => _subscribe(self, method, params),
26 unsubscribe: (method, id) => _unsubscribe(self, method, id)
27 };
28};
\No newline at end of file