Skip to content

Commit

Permalink
Release 2.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Perki committed Oct 3, 2023
1 parent 7b4ce30 commit c6d618e
Show file tree
Hide file tree
Showing 8 changed files with 2,496 additions and 9,150 deletions.
2 changes: 1 addition & 1 deletion components/pryv-monitor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pryv/monitor",
"version": "2.3.6",
"version": "2.3.7",
"description": "Extends `pryv` with event-driven notifications for changes on a Pryv.io account",
"keywords": [
"Pryv",
Expand Down
2 changes: 1 addition & 1 deletion components/pryv-socket.io/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pryv/socket.io",
"version": "2.3.6",
"version": "2.3.7",
"description": "Extends `pryv` with Socket.IO transport",
"keywords": [
"Pryv",
Expand Down
2 changes: 1 addition & 1 deletion components/pryv/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pryv",
"version": "2.3.6",
"version": "2.3.7",
"description": "Pryv JavaScript library",
"keywords": [
"Pryv",
Expand Down
1 change: 0 additions & 1 deletion components/pryv/src/Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class Service {
async isDnsLess () {
const infos = await this.info();
const hostname = infos.api.split('/')[2];
console.log('XXXXX', hostname);
return !hostname.includes('{username}');
}

Expand Down
17 changes: 13 additions & 4 deletions components/pryv/test/Service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/* global describe, it, before, expect, pryv, testData */
/* eslint-disable no-unused-expressions */

const isNode = (typeof window === 'undefined');

describe('Service', function () {
before(async function () {
this.timeout(5000);
Expand Down Expand Up @@ -76,11 +78,18 @@ describe('Service', function () {
this.timeout(5000);
const pryvService = new pryv.Service(testData.serviceInfoUrl);
// check if username is in path or domain
if (await pryvService.isDnsLess()) {
await expect(pryvService.login('wrong-username', 'bobby', 'jslib-test')).to.be.rejectedWith('Unknown user "wrong-username"');
} else {
await expect(pryvService.login('wrong-username', 'bobby', 'jslib-test')).to.be.rejectedWith('getaddrinfo ENOTFOUND wrong');
try {
await pryvService.login('wrong-username', 'bobby', 'jslib-test');
} catch (error) {
let errorMessage = isNode ? 'getaddrinfo ENOTFOUND wrong' : 'Request has been terminated';
if (await pryvService.isDnsLess()) {
errorMessage = 'Unknown user "wrong-username"';
}
const receivedMessage = error.message.slice(0, errorMessage.length);
expect(receivedMessage).to.be.equal(errorMessage);
return;
}
throw new Error('Should fail');
});
});
});
Loading

0 comments on commit c6d618e

Please sign in to comment.