viz-js-lib 0.18.3 → 0.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/lib/browser.js CHANGED
@@ -4,6 +4,7 @@ var api = require('./api');
4
4
  var auth = require('./auth');
5
5
  var broadcast = require('./broadcast');
6
6
  var formatter = require('./formatter')(api);
7
+ var agent = require('./agent')(api);
7
8
  var memo = require('./auth/memo');
8
9
  var aes = require('./auth/ecc/src/aes');
9
10
  var config = require('./config');
@@ -15,6 +16,7 @@ var viz = {
15
16
  broadcast: broadcast,
16
17
  config: config,
17
18
  formatter: formatter,
19
+ agent: agent,
18
20
  memo: memo,
19
21
  aes: aes,
20
22
  utils: utils
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viz-js-lib",
3
- "version": "0.18.3",
3
+ "version": "0.18.4",
4
4
  "description": "viz.js the JavaScript Library with API support for VIZ blockchain",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The browser entry (src/browser.js) has its own export list, separate from src/index.js, and
3
+ * webpack builds dist/viz.min.js from it. In 0.18.3 the agent module existed in the Node build but
4
+ * was missing here, so the released browser bundle silently lacked `viz.agent` while the READMEs
5
+ * said it was a Node-only module. This test pins the shared surface of the two entries.
6
+ */
7
+
8
+ require('babel-polyfill');
9
+ const assert = require('assert');
10
+ const browser = require('../src/browser');
11
+ const node = require('../src/index');
12
+
13
+ const SHARED = ['api', 'auth', 'broadcast', 'config', 'formatter', 'agent', 'memo', 'aes', 'utils'];
14
+
15
+ describe('browser entry exports', function () {
16
+ SHARED.forEach(function (key) {
17
+ it('exposes ' + key + ', like the Node entry does', function () {
18
+ assert.ok(browser[key], key + ' is missing from src/browser.js');
19
+ assert.strictEqual(typeof browser[key], typeof node[key]);
20
+ });
21
+ });
22
+
23
+ it('exposes the agent helpers the browser bundle is documented to carry', function () {
24
+ ['check', 'get', 'find', 'has', 'grants', 'poisoned', 'addonMatches', 'isExpired', 'inAuthority']
25
+ .forEach(function (name) {
26
+ assert.strictEqual(typeof browser.agent[name], 'function', 'viz.agent.' + name + ' is missing');
27
+ });
28
+ });
29
+
30
+ it('publishes viz on window/global, which is how a browser page reaches it', function () {
31
+ assert.strictEqual(global.viz, browser);
32
+ });
33
+ });