@pryv/monitor
Version:
Extends `pryv` with event-driven notifications for changes on a Pryv.io account
27 lines (24 loc) • 741 B
JavaScript
/**
* @license
* [BSD-3-Clause](https://github.com/pryv/lib-js/blob/master/LICENSE)
*/
/* global expect, pryv, testData */
/* eslint-disable no-unused-expressions */
require('../src')(pryv);
const testStreamId = global.testStreamId = 'monitor-test';
global.prepareAndCreateBaseStreams = async () => {
await testData.prepare();
global.apiEndpoint = testData.apiEndpointWithToken;
global.conn = new pryv.Connection(global.apiEndpoint);
const res = await global.conn.api([{
method: 'streams.create',
params: {
id: testStreamId,
name: testStreamId
}
}]);
expect(res[0]).to.exist;
if (res[0].stream) return;
expect(res[0].error).to.exist;
expect(res[0].error.id).to.equal('item-already-exists');
};