pryv 2.3.8 → 2.4.0
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.
- package/README.md +2 -0
- package/package.json +6 -3
- package/test/Browser.AuthController.test.js +1 -1
- package/test/Browser.test.js +2 -2
- package/test/Connection.test.js +15 -10
- package/test/Service.test.js +4 -4
- package/test/ServiceAssets.test.js +1 -1
- package/test/utils.test.js +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# `pryv`: JS library for Pryv.io
|
|
2
2
|
|
|
3
|
+
[](https://codecov.io/gh/pryv/lib-js)
|
|
4
|
+
|
|
3
5
|
JavaScript library and add-ons for writing Node.js and browser apps connecting to a Pryv.io platform. It follows the [Pryv.io app guidelines](https://api.pryv.com/guides/app-guidelines/).
|
|
4
6
|
|
|
5
7
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pryv",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Pryv JavaScript library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Pryv",
|
|
@@ -17,5 +17,8 @@
|
|
|
17
17
|
"license": "BSD-3-Clause",
|
|
18
18
|
"author": "Pryv S.A. <info@pryv.com> (https://pryv.com)",
|
|
19
19
|
"main": "src/index.js",
|
|
20
|
-
"types": "src/index.d.ts"
|
|
21
|
-
|
|
20
|
+
"types": "src/index.d.ts",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"superagent": "^9.0.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/test/Browser.test.js
CHANGED
package/test/Connection.test.js
CHANGED
|
@@ -20,7 +20,7 @@ if (isNode) { // node
|
|
|
20
20
|
|
|
21
21
|
describe('Connection', () => {
|
|
22
22
|
before(async function () {
|
|
23
|
-
this.timeout(
|
|
23
|
+
this.timeout(15000);
|
|
24
24
|
await testData.prepare();
|
|
25
25
|
conn = new pryv.Connection(testData.apiEndpointWithToken);
|
|
26
26
|
|
|
@@ -90,7 +90,7 @@ describe('Connection', () => {
|
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
describe('.api()', function () {
|
|
93
|
-
this.timeout(
|
|
93
|
+
this.timeout(15000);
|
|
94
94
|
it('.api() events.get', async () => {
|
|
95
95
|
const res = await conn.api(
|
|
96
96
|
[
|
|
@@ -317,7 +317,7 @@ describe('Connection', () => {
|
|
|
317
317
|
});
|
|
318
318
|
|
|
319
319
|
describe('Streamed event get', function () {
|
|
320
|
-
this.timeout(
|
|
320
|
+
this.timeout(15000);
|
|
321
321
|
const now = (new Date()).getTime() / 1000 + 1000;
|
|
322
322
|
|
|
323
323
|
describe('Node & Browser', function () {
|
|
@@ -369,6 +369,11 @@ describe('Connection', () => {
|
|
|
369
369
|
|
|
370
370
|
if (typeof window === 'undefined') {
|
|
371
371
|
describe('Browser mock', function () {
|
|
372
|
+
const isNotAvailable = {
|
|
373
|
+
URL: global.URL == null,
|
|
374
|
+
URLSearchParams: global.URLSearchParams == null,
|
|
375
|
+
fetch: global.fetch == null
|
|
376
|
+
};
|
|
372
377
|
beforeEach(function () {
|
|
373
378
|
const browser = new Browser();
|
|
374
379
|
browser.visit('./');
|
|
@@ -378,18 +383,18 @@ describe('Connection', () => {
|
|
|
378
383
|
function fetch (...args) {
|
|
379
384
|
return browser.fetch(...args);
|
|
380
385
|
}
|
|
381
|
-
global.fetch = fetch;
|
|
382
|
-
global.URL = URL;
|
|
383
|
-
global.URLSearchParams = URLSearchParams;
|
|
386
|
+
if (isNotAvailable.fetch) global.fetch = fetch;
|
|
387
|
+
if (isNotAvailable.URL) global.URL = URL;
|
|
388
|
+
if (isNotAvailable.URLSearchParams) global.URLSearchParams = URLSearchParams;
|
|
384
389
|
});
|
|
385
390
|
|
|
386
391
|
afterEach(function () {
|
|
387
392
|
delete global.document;
|
|
388
393
|
delete global.window;
|
|
389
394
|
delete global.location;
|
|
390
|
-
delete global.fetch;
|
|
391
|
-
delete global.URL;
|
|
392
|
-
delete global.URLSearchParams;
|
|
395
|
+
if (isNotAvailable.fetch) delete global.fetch;
|
|
396
|
+
if (isNotAvailable.URL) delete global.URL;
|
|
397
|
+
if (isNotAvailable.URLSearchParams) delete global.URLSearchParams;
|
|
393
398
|
});
|
|
394
399
|
|
|
395
400
|
it(' without fetch', async () => {
|
|
@@ -421,7 +426,7 @@ describe('Connection', () => {
|
|
|
421
426
|
{
|
|
422
427
|
method: 'accesses.create',
|
|
423
428
|
params: {
|
|
424
|
-
name: 'test',
|
|
429
|
+
name: 'test' + Math.round(Math.random() * 10000),
|
|
425
430
|
permissions: [
|
|
426
431
|
{
|
|
427
432
|
streamId: 'data',
|
package/test/Service.test.js
CHANGED
|
@@ -9,7 +9,7 @@ const isNode = (typeof window === 'undefined');
|
|
|
9
9
|
|
|
10
10
|
describe('Service', function () {
|
|
11
11
|
before(async function () {
|
|
12
|
-
this.timeout(
|
|
12
|
+
this.timeout(15000);
|
|
13
13
|
await testData.prepare();
|
|
14
14
|
});
|
|
15
15
|
|
|
@@ -36,7 +36,7 @@ describe('Service', function () {
|
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
it('login()', async function () {
|
|
39
|
-
this.timeout(
|
|
39
|
+
this.timeout(15000);
|
|
40
40
|
const pryvService = new pryv.Service(testData.serviceInfoUrl);
|
|
41
41
|
const conn = await pryvService.login(testData.username, testData.password, 'jslib-test');
|
|
42
42
|
expect(conn).to.exist;
|
|
@@ -69,13 +69,13 @@ describe('Service', function () {
|
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
it('login() failed on wrong password', async function () {
|
|
72
|
-
this.timeout(
|
|
72
|
+
this.timeout(15000);
|
|
73
73
|
const pryvService = new pryv.Service(testData.serviceInfoUrl);
|
|
74
74
|
await expect(pryvService.login(testData.username, 'bobby', 'jslib-test')).to.be.rejectedWith('The given username/password pair is invalid.');
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
it('login() failed on wrong username', async function () {
|
|
78
|
-
this.timeout(
|
|
78
|
+
this.timeout(15000);
|
|
79
79
|
const pryvService = new pryv.Service(testData.serviceInfoUrl);
|
|
80
80
|
// check if username is in path or domain
|
|
81
81
|
try {
|