Skip to content

Commit

Permalink
Merge pull request RocketChat#237 from assistify/feature/linting-erro…
Browse files Browse the repository at this point in the history
…r-fix

fix all linting errors plus 2 bug fixes in tests
  • Loading branch information
mrsimpson authored Feb 16, 2018
2 parents 4cee373 + 917f736 commit 75f78c8
Show file tree
Hide file tree
Showing 31 changed files with 90 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .scripts/dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM assisitfy/smarti:0.6.1
FROM assisitfy/smarti:0.7.0-BETA
USER root
ADD [\
"https://repo1.maven.org/maven2/edu/stanford/nlp/stanford-corenlp/3.8.0/stanford-corenlp-3.8.0.jar", \
Expand Down
6 changes: 3 additions & 3 deletions .scripts/seperateTesting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
tmpPath=tests/end-to-end/temporary_staged_test
rm -rf $tmpPath
mkdir -p $tmpPath
[ -z "$num" ] && num=1
for file in tests/end-to-end/ui/*.js; do
[ -z "$retry_test" ] && retry_test=1
for file in tests/end-to-end/api/*.js; do

failed=1
for i in `seq 1 $num`; do
for i in `seq 1 $retry_test`; do
echo '-------------- '$i' try ---------------'
set -x
cp $file $tmpPath
Expand Down
2 changes: 1 addition & 1 deletion .scripts/smarti.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

docker pull assisitfy/smarti:0.6.1
docker pull assisitfy/smarti:0.7.0-BETA

#docker run -d --net=host assisitfy/smarti:0.6.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
return;
}

SystemLogger.debug(`Send message ${message._id} to knowledgeAdapter (Meteor.defer()`);
SystemLogger.debug(`Send message ${ message._id } to knowledgeAdapter (Meteor.defer()`);
Meteor.defer(() => {
try {
SystemLogger.debug(`Calling onMessage(${message._id});`);
SystemLogger.debug(`Calling onMessage(${ message._id });`);
knowledgeAdapter.onMessage(message);
} catch (e) {
SystemLogger.error('Error using knowledge provider ->', e);
Expand Down
2 changes: 2 additions & 0 deletions packages/assistify-ai/server/lib/AiApiAdapter.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* globals _ */

export class ApiAiAdapter {
constructor(adapterProps) {
this.properties = adapterProps;
Expand Down
4 changes: 2 additions & 2 deletions packages/assistify-ai/server/lib/SmartiAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class SmartiAdapter {
}, {
rid: message.rid,
knowledgeProvider: 'smarti',
conversationId: conversationId,
conversationId,
ts: message.ts
}, {
upsert: true
Expand Down Expand Up @@ -86,7 +86,7 @@ export class SmartiAdapter {
}

if (conversationId) {
SystemLogger.debug(`Conversation ${conversationId} found for channel ${message.rid}`);
SystemLogger.debug(`Conversation ${ conversationId } found for channel ${ message.rid }`);
// add message to conversation
SmartiProxy.propagateToSmarti(verbs.post, `conversation/${ conversationId }/message`, requestBodyMessage);
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* globals _ */
/* globals AutoComplete, Deps */
import {RocketChat} from 'meteor/rocketchat:lib';
import {FlowRouter} from 'meteor/kadira:flow-router';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* globals TAPi18n, AutoComplete */
/* globals _ */
import {RocketChat} from 'meteor/rocketchat:lib';
import {FlowRouter} from 'meteor/kadira:flow-router';
import {ReactiveVar} from 'meteor/reactive-var';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

/* globals _ */
/* globals s */
function __guard__(value, transform) {
return (typeof value !== 'undefined' && value !== null) ? transform(value) : undefined;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* globals _ */
Meteor.methods({
//adapted copy of server/methods/channelsList.js
requestsList(filter, channelType, limit, sort) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* globals _ */
/**
* Created by OliverJaegle on 01.08.2016.
*/
Expand Down
1 change: 1 addition & 0 deletions packages/assistify-help-request/server/models/Rooms.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* globals _ */
/**
* Created by OliverJaegle on 01.08.2016.
*/
Expand Down
1 change: 1 addition & 0 deletions packages/assistify-help-request/server/models/Users.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* globals s */
/**
* Created by OliverJaegle on 01.08.2016.
* Expose features of the users-collection which are not exposed by default
Expand Down
1 change: 1 addition & 0 deletions packages/meteor-accounts-saml/saml_utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* globals SAML:true */
/*eslint complexity: ["error", 40]*/

import zlib from 'zlib';
import xml2js from 'xml2js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*globals OAuth*/
/*eslint complexity: ["error", 40]*/
import _ from 'underscore';

const logger = new Logger('CustomOAuth');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* globals TAPi18n, AutoComplete */
/* globals _ */
import {RocketChat} from 'meteor/rocketchat:lib';
import {FlowRouter} from 'meteor/kadira:flow-router';
import {ReactiveVar} from 'meteor/reactive-var';
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-lib/server/functions/saveUser.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* globals Gravatar */
/*eslint complexity: ["error", 50]*/
import _ from 'underscore';
import s from 'underscore.string';

Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-lib/server/functions/settings.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*eslint complexity: ["error", 40]*/
import _ from 'underscore';

const blockedSettings = {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* globals Push */
/*eslint complexity: ["error", 40]*/
import _ from 'underscore';
import s from 'underscore.string';
import moment from 'moment';
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-lib/server/models/Rooms.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* globals RocketChat, SystemLogger */
import _ from 'underscore';
import s from 'underscore.string';

Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-slackbridge/server/slackbridge.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* globals logger */
/*eslint complexity: ["error", 50]*/
import _ from 'underscore';
import util from 'util';
import url from 'url';
Expand Down
1 change: 1 addition & 0 deletions server/publications/room.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* globals RocketChat, SystemLogger */
import _ from 'underscore';

const fields = {
Expand Down
2 changes: 2 additions & 0 deletions tests/end-to-end/api/06-outgoing-integrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import supertest from 'supertest';
describe('Outgoing Integrations', function() {
this.retries(0);

before(done => getCredentials(done));

it('/integrations.create', (done) => {
request.post(api('integrations.create'))
.set(credentials)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-env mocha */
import supertest from 'supertest';
import {adminUsername, adminPassword} from '../../data/user.js';
export const rcrequest = supertest.agent('http://localhost:3000');
Expand All @@ -21,7 +22,7 @@ describe('[Custom Room Types]', function() {
.end(function(err, res) {
authToken = res.body.data.authToken;
userId = res.body.data.userId;
expect(res.status).to.be.equal(200);
res.status.should.be.equal(200);
process.env.METEOR_TOKEN = authToken;
done();
});
Expand Down Expand Up @@ -55,10 +56,9 @@ describe('[Custom Room Types]', function() {
retry: 5
},

function(error, userInfo) {
function(error) {
if (error) {
console.log(`ERROR: ${ error }`);
expect(0).to.equal(1);
throw new Error(`ERROR: ${ error }`);
} else {
// console.log(userInfo);
ddpClient.call(
Expand Down Expand Up @@ -113,10 +113,9 @@ describe('[Custom Room Types]', function() {
retry: 5
},

function(error, userInfo) {
function(error) {
if (error) {
console.log(`ERROR: ${ error }`);
expect(0).to.equal(1);
throw new Error(`ERROR: ${ error }`);
} else {
// console.log(userInfo);
ddpClient.call(
Expand Down Expand Up @@ -175,10 +174,9 @@ describe('[Custom Room Types]', function() {
retry: 5
},

function(error, userInfo) {
function(error) {
if (error) {
console.log(`ERROR: ${ error }`);
expect(0).to.equal(1);
throw new Error(`ERROR: ${ error }`);
} else {
// console.log(userInfo);
ddpClient.call(
Expand All @@ -188,16 +186,16 @@ describe('[Custom Room Types]', function() {
// console.log('GetRooms, result: ' + result);
for (const i in result) {
// console.log(result[i]);
if (result[i].t == 'test' && result[i].name == 'NewTestRoom') {
if (result[i].t === 'test' && result[i].name === 'NewTestRoom') {
console.log('found test room');
expect(result[i]._id).to.be.equal(roomid);
result[i]._id.should.be.equal(roomid);
}
}
if (typeof err !== 'undefined') {
console.log('error happend: ');
console.log(err);
}
expect(roomid).to.not.equal(undefined);
roomid.should.not.equal(undefined);
},
function() { // callback which fires when server has finished
// console.log('GetRooms - Function was finished'); // sending any updated documents as a result of
Expand Down Expand Up @@ -238,10 +236,9 @@ describe('[Custom Room Types]', function() {
retry: 5
},

function(error, userInfo) {
function(error) {
if (error) {
console.log(`ERROR: ${ error }`);
expect(0).to.equal(1);
throw new Error(`ERROR: ${ error }`);
} else {
// console.log(userInfo);
ddpClient.call(
Expand All @@ -250,7 +247,7 @@ describe('[Custom Room Types]', function() {
function(err, result) { // callback which returns the method call results
// console.log('EraseRoom, result: ');
if (typeof result !== 'undefined') {
expect(result).to.be.equal(1);
result.should.be.equal(1);
// console.log(result);
}
if (typeof err !== 'undefined') {
Expand Down Expand Up @@ -297,10 +294,9 @@ describe('[Custom Room Types]', function() {
retry: 5
},

function(error, userInfo) {
function(error) {
if (error) {
console.log(`ERROR: ${ error }`);
expect(0).to.equal(1);
throw new Error(`ERROR: ${ error }`);
} else {
// console.log(userInfo);
ddpClient.call(
Expand All @@ -310,18 +306,20 @@ describe('[Custom Room Types]', function() {
// console.log('GetRooms, result: ' + result);
for (const i in result) {
// console.log(result[i]);
if (result[i].t == 'test' && result[i].name == 'NewTestRoom') {
if (result[i].t === 'test' && result[i].name === 'NewTestRoom') {
console.log('found test room');
expect(result[i]._id).to.be.equal(roomid);
result[i]._id.should.be.equal(roomid);
} else if (result[i].t !== 'd') {
result[i].t.should.not.equal('test');
result[i].name.should.not.equal('NewTestRoom');
}
expect(result[i].t).to.not.equal('test');
expect(result[i].name).to.not.equal('NewTestRoom');

}
if (typeof err !== 'undefined') {
console.log('error happend: ');
console.log(err);
}
expect(roomid).to.not.equal(undefined);
roomid.should.not.equal(undefined);
},
function() { // callback which fires when server has finished
// console.log('GetRooms - Function was finished'); // sending any updated documents as a result of
Expand Down
3 changes: 2 additions & 1 deletion tests/end-to-end/ui/14-global-announcement.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-env mocha */
import supertest from 'supertest';
import {adminUsername, adminEmail, adminPassword} from '../../data/user.js';
import loginPage from '../../pageobjects/login.page';
Expand All @@ -22,7 +23,7 @@ describe('[Rocket.Chat Global Announcement Tests]', function() {
.end(function(err, res) {
authToken = res.body.data.authToken;
userId = res.body.data.userId;
expect(res.status).to.be.equal(200);
res.status.should.be.equal(200);
done();
});
});
Expand Down
19 changes: 5 additions & 14 deletions tests/end-to-end/ui/15-settings-based-permissions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-env mocha */
import { adminUsername, adminEmail, adminPassword, username, email, password } from '../../data/user.js';
import admin from '../../pageobjects/administration.page';
import { checkIfUserIsValid, checkIfUserIsAdmin } from '../../data/checks';
Expand Down Expand Up @@ -30,7 +31,7 @@ describe('[Rocket.Chat Settings based permissions]', function() {
manageSettingsPerm.click();
console.log('Value was unchecked', manageSettingsPerm.isSelected());
}
expect(manageSettingsPerm.isSelected()).to.equal(true);
manageSettingsPerm.isSelected().should.equal(true);
done();
});

Expand All @@ -42,7 +43,7 @@ describe('[Rocket.Chat Settings based permissions]', function() {
layoutTitelPerm.click();
console.log('Value was unchecked, now:', layoutTitelPerm.isSelected());
}
expect(layoutTitelPerm.isSelected()).to.equal(true);
layoutTitelPerm.isSelected().should.equal(true);
done();
});

Expand Down Expand Up @@ -72,16 +73,6 @@ describe('[Rocket.Chat Settings based permissions]', function() {
browser.pause(2000);
console.log('New Titel value:', layoutTitelSetting.getValue());
saveSettings.click();

// layoutTitelSetting.setValue('');
// browser.pause(2000);
// console.log('New Titel value:', layoutTitelSetting.getValue() );
// saveSettings.click();
//
// layoutTitelSetting.setValue(newTitle);
// browser.pause(2000);
// console.log('New Titel value:', layoutTitelSetting.getValue() );
// saveSettings.click();
done();
});
});
Expand Down Expand Up @@ -111,12 +102,12 @@ describe('[Rocket.Chat Settings based permissions]', function() {
admin.rolesPermissionGrid.waitForVisible(5000);

manageSettingsPerm.click();
expect(manageSettingsPerm.isSelected()).to.equal(false);
manageSettingsPerm.isSelected().should.equal(false);

expandSBP.click();

layoutTitelPerm.click();
expect(layoutTitelPerm.isSelected()).to.equal(false);
layoutTitelPerm.isSelected().should.equal(false);
done();
});

Expand Down
Loading

0 comments on commit 75f78c8

Please sign in to comment.